Git和讨厌的“错误:无法锁定现有的致命信息/参考" [英] Git and nasty "error: cannot lock existing info/refs fatal"

查看:37
本文介绍了Git和讨厌的“错误:无法锁定现有的致命信息/参考"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从远程git仓库克隆后(以更好的代码)我做了一些更改,提交了并尝试推送:

After cloning from remote git repository (at bettercodes) I made some changes, commited and tried to push:

git push origin master

错误:

错误:无法锁定现有的信息/参考
致命:git-http-push失败

error: cannot lock existing info/refs
fatal: git-http-push failed

这种情况涉及已经存在的存储库.

This case regards already existing repository.

我之前所做的是:

  1. git config –global http.sslVerify false
  2. git init
  3. git remote add [url]
  4. git clone
  5. 更改数据
  6. git commit

在更好的代码"处,我无权访问git log.

At 'bettercodes' I have no access to git log.

我正在使用Windows.详细的错误是:

I'm using Windows. The detailed error was:

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

我以前克隆过,然后更改了代码并提交了.

I cloned before, then changed the code and committed.

推荐答案

对我来说,这可行:

git远程修剪起源

由于此答案似乎对很多人都有帮助,因此我对此处实际发生的情况做了一些探讨.这样做是在文件夹 .git/refs/remotes/origin 中删除对远程分支的引用.因此,这不会影响您的本地分支机构,也不会更改任何远程对象,但会更新您对远程分支机构的本地引用.在某些情况下,这些引用可能包含Git无法正确处理的数据.

Since this answer seems to help a lot of people, I dug a little bit into what actually happens here. What this will do is remove references to remote branches in the folder .git/refs/remotes/origin. So this will not affect your local branches and it will not change anything remote, but it will update the local references you have to remote branches. It seems in some cases these references can contain data Git cannot handle correctly.

这篇关于Git和讨厌的“错误:无法锁定现有的致命信息/参考"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆