Git - 执行git pull 一直报错 error: cannot lock ref

1.应用场景

主要用于git pull 远程分支代码, 出现报错, 原因以及解决办法.

2.学习/操作

1.文档阅读

https://blog.csdn.net/qq_15437667/article/details/52479792

https://stackoverflow.com/questions/6656619/git-and-nasty-error-cannot-lock-existing-info-refs-fatal

2.整理输出

2.1 执行git pull 出现报错

From github.com:seekasia/siva
 * [new branch]          Hotfix/sycee-633_my_product_options -> 
origin/Hotfix/sycee-633_my_product_options
error: cannot lock ref 'refs/remotes/origin/SATS-460/fix/remove-bookmark-when-page->-1-not-working': Unable to create 'D:/william/provision/src/siva/.git/refs/remotes/origin/SATS-460/fix/remove-bookmark-when-page->-1-not-working.lock': Invalid argument    
 ! [new branch]          SATS-460/fix/remove-bookmark-when-page->-1-not-working -> origin/SATS-460/fix/remove-bookmark-when-page->-1-not-working  (unable to update local ref)
   bc5e0e51c..540861cf0  hotfix/sycee-633_my_product_options -> 
origin/hotfix/sycee-633_my_product_options

原因:

TBD

解决办法:

1.强制拉取

执行还是有问题, 没能拉取最新的远程代码

2. 删除对应的ref文件

还是不行.

最后的解决办法:

git remote prune origin

git pull origin master

推测原因:

某种原因导致 git pull不能拉取远程分支, 需要使用git pull origin master 才行

需要重新设置一遍才行

结果还是不行, 还是要执行

git pull origin 分支名  完整命令才可以  /// 具体仍在寻找原因和解决办法中.

再不济, 就是重新clone仓库试试

后续补充

...

3.问题/补充

TBD

4.参考

https://stackoverflow.com/questions/6656619/git-and-nasty-error-cannot-lock-existing-info-refs-fatal

后续补充

...

猜你喜欢

转载自blog.csdn.net/william_n/article/details/114014239
今日推荐