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

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


当前回答

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

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

其他回答

我遇到了这个问题,当我试图创建一个包含旧分支名称的新功能分支时,例如origin - branch1,我想创建branch1-feature。 这是不可能的,但branch1/feature已经实现了。

对我有用的是:

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

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

我通过以下方法解决了这个问题

git branch --unset-upstream
rm .git/refs/remotes/origin/{branch}
git gc --prune=now
git branch --set-upstream-to=origin/{branch} {branch}
#or git push --set-upstream origin {branch}
git pull

这假设你的本地和远程分支是对齐的,你只是得到的refs错误为非致命的。

在我的情况下,我不得不手动删除旧标签已被删除的远程。

在我的情况下,在收到这条消息后,我执行了checkout命令,并得到了以下消息:

Your branch is based on 'origin/myBranch', but the upstream is gone.
  (use "git branch --unset-upstream" to fixup)

执行这个命令后,我恢复了正常。