美文网首页
解决git远程仓库pull时报错问题

解决git远程仓库pull时报错问题

作者: 王洛书 | 来源:发表于2016-08-04 10:13 被阅读0次

每天都要打开sourcetree pull and push,感觉不太方便,于是切到了Xcode进行,填完username and password后,开始pull。

此时报错(.gitignore已配置忽略文件):

The working copy “Git-Projects” has uncommitted changes.

Commit or discard the changes and try again.

百度解决方法都是删除UserInterfaceState.xcuserstate。前提是进入此描述文件路径下,试了几种不同的方式,在commit时,此文件还是存在。

解决方法:

1.先切换到本地仓库路径:cd /Users/etong/Git-Projects

2.执行重置命令:git reset --hard

提示成功:HEAD is now at 287c050 删除工程中UserInterfaceState.xcuserstate。

此时就可以pull远程仓库代码了。

----------------------------------------------------------------------------------------

做了以上操作后以为解决问题了,但其实过了几分钟此报错又出来了,因为又生成了UserInterfaceState.xcuserstate

----------------------------------------------------------------------------------------

好吧,

继续解决:

1.切换到工程目录下:cd cd /Users/etong/Git-Projects/EongMallV-2-5

2.执行下面2行命令:

git rm--cached 工程名.xcodeproj/project.xcworkspace/xcuserdata/账户名.xcuserdatad/UserInterfaceState.xcuserstate

gitcommit-m"Removed file that shouldn't be tracked"

3..gitignore中配置好忽略文件 ( 以后再编辑整理 ) :

# Mac OS X

*.DS_Store

# Xcode

*.pbxuser

*.mode1v3

*.mode2v3

*.perspectivev3

*.xcuserstate

project.xcworkspace/

xcuserdata/

project.xcworkspace

xcuserdata

UserInterfaceState.xcuserstate

UserInterface.xcuserstate

4.我重启了Xcode,再pull commit不再出现报错。

相关文章

网友评论

      本文标题:解决git远程仓库pull时报错问题

      本文链接:https://www.haomeiwen.com/subject/vlfcsttx.html