git pull 错误:无法锁定 ref 'ref/remotes/origin/xxx' ... 存在;不能创造

Joh*_*tle 3 git

我今天已经做了几次 git pull,没有问题。我没有在本地更改或修改任何内容。

现在我又做了一次 git pull,突然得到了这个:

error: cannot lock ref 'refs/remotes/origin/task/DEV-2527/DEV-2535': 'refs/remotes/origin/task/DEV-2527' exists; cannot create 'refs/remotes/origin/task/DEV-2527/DEV-2535'
From https://dev.azure.com/xxx/xxx-web/_git/xxx-web
 ! [new branch]          task/DEV-2527/DEV-2535 -> origin/task/DEV-2527/DEV-2535  (unable to update local ref)
Run Code Online (Sandbox Code Playgroud)

我尝试了“git gc”,但这没有帮助。

我读过“git remote prune origin”可能有帮助,但我不想做任何可能损坏 azure 远程存储库的事情。

Joh*_*tle 7

git fetch --修剪

为我修好了。开发人员意外地使用旧分支的路径创建了一个新分支。旧分支后来在源上被删除,因此大概 prune 在本地修复了这个问题。