我只有分支主和我得到这个错误,每次我尝试“git拉”:

error: Couldn't set refs/remotes/origin/master
From /var/lib/git/xxx/project
 ! a0f80ea..49177a3  master     -> origin/master  (unable to update local ref)

当我执行“git pull origin master”时,我得到:

error: Couldn't set ORIG_HEAD
fatal: Cannot update the ref 'ORIG_HEAD'.

我一直在寻找,却找不到原因


当前回答

试着在你的git仓库根文件夹中使用这个命令:

rm .git/logs/refs/remotes/origin/master 

其他回答

使用gitbach line命令,使用git update-ref来更新本地分支的引用:

$ git update-ref -d refs/remotes/origin/[locked branch name]

然后使用$ git拉

[locked branch name]是由于提交id不匹配而发生错误的分支的名称。

参rm . / /遥控器/产地/主人

这对我很管用!

这对Windows来说已经足够了:

Git包引用——全部

如果你最近更改了密码,并且有一些奇特的东西集成了你的Windows和Linux登录,也会发生这个错误(无法更新本地ref)。

这对我来说非常合适:

rm -rf .git/packed-refs .git/rr-cache