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

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


当前回答

对我有用的是:

删除. /日志/文献/遥控器/产地/分支 删除. / refs /遥控器/产地/分支 运行git gc——prune=now

更多关于git gc命令的信息请访问:https://git-scm.com/docs/git-gc

其他回答

以bettercodes.org为例,解决方案更加富有诗意——唯一的问题可能是分配给项目成员的权利。简单成员没有写权限!请确保您具有主持人或管理员权限。当然,这需要管理员在bettercodes.org的项目设置中进行设置。

你想尝试做:

git gc --prune=now

参见https://www.kernel.org/pub/software/scm/git/docs/git-gc.html

更新:

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

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


最初的回答:

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

git config –global http.sslVerify true

这就是我的工作方式。

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

还有更快的选择:

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

这是我所做的,以摆脱所有的锁引用问题:

git gc --prune=now
git remote prune origin

这可能也是你唯一需要做的。

更多关于git gc命令的信息请访问:https://git-scm.com/docs/git-gc

更多关于git远程修剪的信息请访问:https://git-scm.com/docs/git-remote#Documentation/git-remote.txt-empruneem