从远程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

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


当前回答

这听起来像是一个权限问题——有没有可能你打开了两个窗口,使用不同的权限执行?也许可以检查.git文件夹的所有权。

也许检查是否有未完成的文件锁打开,也许使用lsof检查,或者对您的操作系统使用相同的方法。

其他回答

我遇到这个问题是因为我所在的分支与上游分支具有类似的名称。例如,上游分支被称为示例分支,我的本地分支被称为示例分支/后端。解决方案是更改我的本地分支机构的名称,如下所示:

git branch -m <new name goes here>

当我试图运行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),一切都正常工作。

在git pull之前运行git fetch。这样问题就解决了。

这个问题现在可能已经解决了。但这是对我有效的方法。

Location: If locked repository is on the server-side: ssh to your git repository on the server. Login as user which has permissions to modify the repository and navigate to the repository on your server. If locked repository is local only: Open the git console and navigate to the repository directory. Run this command: git update-server-info Fix the permissions on your (remote or/and local) repository if you have to. In my case I had to chmod to 777 and chown to apache:apache Try to push again from the local repository: git push