从远程git存储库克隆后(在bettercodes) 我做了一些改变,承诺 并试图推动:

git push origin master

错误:

错误:不能锁定现有的信息/引用 致命:git-http-push失败

本案例涉及已经存在的存储库。

我之前做的是:

Git配置-global http。sslVerify假 git init Git远程添加[url] git克隆 更改数据 git提交

在'bettercodes'我没有访问git日志。

我用的是Windows。 具体的错误是:

C:\MyWorkStuff\Projects\Ruby\MyProject\>git push origin master
Unable to create branch path https://user:password@git.bettercodes.org/myproject/info/
error: cannot lock existing info/refs
fatal: git-http-push failed

我之前克隆过,然后修改代码并提交。


当前回答

情况1:检查git-server上的分支是否重复。

Example: two branches below are duplicated:

    - upper_with_lower
    - UPPER_with_lower

---> Let consider removing one of them.

情况2:您正在推送的分支与其他分支重复。

其他回答

在拉之前,你需要清理你的局部变化。下面的命令帮助我解决。

git remote prune origin

之后

git pull origin develop

希望这能有所帮助!

当我试图运行git filter-branch将许多子目录分离到一个新的、单独的存储库(如这个答案)时,我看到了这个错误。

我尝试了以上所有的解决方案,但没有一个有效。最终,我决定我不需要在新的分支中保存我的标签,只是运行:

git remote remove origin
git tag | xargs git tag -d
git gc --prune=now
git filter-branch --index-filter 'git rm --cached -qr --ignore-unmatch -- . && git reset -q $GIT_COMMIT -- apps/AAA/ libs/xxx' --prune-empty -- --all

在我的例子中,一个分支被移动到一个子目录,这个目录被称为分支。Git对此感到困惑。当我删除本地分支时(在SourceTree中只需右键单击delete),一切都正常工作。

更新:

你可能需要编辑~/.netrc文件:

https://bugs.launchpad.net/ubuntu/+source/git-core/+bug/293553


最初的回答:

为什么禁用ssl?我想这可能与你无法通过https推送有关。我会把它放回去,再试着推一下:

git config –global http.sslVerify true

运行命令git update-ref -d refs/heads/origin/branch修复。