操作git从远端拉去代码时,报出了下面的问题,cannot lock ref,
git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree fetch origin
error: cannot lock ref 'refs/remotes/origin/dev': ref refs/remotes/origin/dev is at 19070aed6873f8d58f35e4631272b59f13927a1c but expected 8a5b3bda0778070bd6b92123556475c9484e04b8
From 120.26.77.241:dongjia/php
! 8a5b3bd..007af81 dev -> origin/dev (unable to update local ref)
Completed with errors, see above
From 120.26.77.241:yourWorkspace/yourProject
遇到了两种解决方法,
切到项目根目录,
方法一 : 执行git remote prune origin,让后git fetch;(推荐使用)
方法二: 执行rm .git/refs/remotes/origin/dev(develop),然后git fetch;使用此方法需要权限
网友评论