Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git and nasty "error: cannot lock existing info/refs fatal"

Tags:

git

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

git push origin master 

Errors with:

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

This case regards already existing repository.

What I did before, was:

  1. git config –global http.sslVerify false
  2. git init
  3. git remote add [url]
  4. git clone
  5. change data
  6. git commit

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

I'm using Windows. The detailed error was:

C:\MyWorkStuff\Projects\Ruby\MyProject\>git push origin master Unable to create branch path https://user:[email protected]/myproject/info/ error: cannot lock existing info/refs fatal: git-http-push failed 

I cloned before, then changed the code and committed.

like image 512
AnnD Avatar asked Jul 11 '11 21:07

AnnD


People also ask

How do I fix git error failed to push some refs to?

If you get a failed to push some refs to error, the main thing to do is git pull to bring your local repo up to date with the remote. Avoid employing the --force flag when using git pull and prevent other developers' accidental overwrites of committed features.

What is prune command in git?

The git prune command is an internal housekeeping utility that cleans up unreachable or "orphaned" Git objects. Unreachable objects are those that are inaccessible by any refs. Any commit that cannot be accessed through a branch or tag is considered unreachable. git prune is generally not executed directly.


1 Answers

For me this worked (won't change in remote):

git remote prune origin

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.

like image 96
arno_v Avatar answered Oct 05 '22 19:10

arno_v