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

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


当前回答

更新:

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

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


最初的回答:

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

git config –global http.sslVerify true

其他回答

当我试图运行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进程)是否可以访问文件.git/info/refs,并且这个文件没有被其他进程锁定。

如果您很幸运,没有本地工作要提交/推送,也没有时间去喝咖啡,您可以简单地删除回购的本地副本并重新克隆

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

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

这就是我的工作方式。

在服务器上查找Apache DAV锁文件(例如/var/lock/apache2/DAVlock) 删除它 重新创建具有写权限的web服务器 重新启动web服务器

还有更快的选择:

在服务器上查找Apache DAV锁文件(例如/var/lock/apache2/DAVlock) 清空文件:cat /dev/null > /var/lock/apache2/DAVlock 重新启动web服务器