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

其他回答

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

在我的例子中,它与我已经创建的分支名称相连接。

为了解决这个问题,我创建了一个分支,它的名字肯定不应该存在,比如:

git checkout -b some_unknown_branch

然后我清除了所有其他分支(不活动),因为它们只是不必要的垃圾。

git branch | grep -v \* | grep -v master | xargs git branch -D

然后用我想要的名字重命名我的当前分支,比如:

git checkout -m my_desired_branch_name

更新:

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

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


最初的回答:

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

git config –global http.sslVerify true

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

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

对我有用的是:

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

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