我正在尝试执行以下git命令-
git fetch --tags --progress https://github.com/<org>/<repo-name>.git +refs/pull/*:refs/remotes/origin/pr/*
并不断出错:
error: cannot lock ref 'refs/remotes/origin/pr/1/head': 'refs/remotes/origin/pr' exists; cannot create 'refs/remotes/origin/pr/1/head'
From https://github.com/<org>/<repo-name>
! [new ref] refs/pull/1/head -> origin/pr/1/head (unable to update local ref)
error: cannot lock ref 'refs/remotes/origin/pr/10/head': 'refs/remotes/origin/pr' exists; cannot create 'refs/remotes/origin/pr/10/head'
! [new ref] refs/pull/10/head -> origin/pr/10/head (unable to update local ref)
error: cannot lock ref 'refs/remotes/origin/pr/100/head': 'refs/remotes/origin/pr' exists; cannot create 'refs/remotes/origin/pr/100/head'
! [new ref] refs/pull/100/head -> origin/pr/100/head (unable to update local ref)
任何有关解决方法的提示将不胜感激。
答案 0 :(得分:1)
似乎以前有一个名为pr
的分支,而新分支位于该名称的文件夹中,因此发生冲突。
尝试git remote prune origin
,它将删除旧分支的本地跟踪副本,然后再次删除命令。