1. 退出xcdoe, 打开终端(Terminal),进入到你的项目目录下
2. 在终端键入 git rm --cached [YourProjectName].xcodeproj/project.xcworkspace/xcuserdata/[YourUsername].xcuserdatad/UserInterfaceState.xcuserstate
3. 在终端键入 git commit -m "Removed file that shouldn't be tracked"
4. 在.gitignore文件中加入如下几行
*.xcuserstate
project.xcworkspace
xcuserdata
UserInterfaceState.xcuserstate
project.xcworkspace/
xcuserdata/
UserInterface.xcuserstate
5. 重新打开Xcode commit, push。
另外:查看git仓库的文件的命令行是 git ls-files