Error: cannot lock ref-Git and nasty “error: cannot lock existing info/refs fatal”

1.1K    Asked by arun_3288 in Devops , Asked on May 5, 2021

 After cloning from the remote git repository (at better codes) I made some changes, committed 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:

    git config –global http.sslVerify false
    git init
    git remote add [url]
    git clone
    change data
    git commit

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

              I'm using Windows. The detailed error was:

              C:MyWorkStuffProjectsRubyMyProject>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.

              Answered by Amit raj

              I was facing error:cannot lock ref and the solution worked for me:

                    git remote prune origin

              What this will do is it removes 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 remotely, but it will update the local references you have to remote branches. It seems in some cases these references may have data Git cannot handle correctly.



              Your Answer

              Interviews

              Parent Categories