Search code examples
githttpsgit-push

git push fails: cannot lock existing info/refs


When I try to push to my git repo (on an HTTPS server) i get the following error:

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

I don't know if this is relevant, but I accidentally did a

git add .git

It didn't seem to do anything, so I assumed git was jut smart enough to ignore me.

Why is git failing to push, and how can I fix it?

Pull works fine.

Extra info: I have another local clone, which I can still push to the central repo from. I think this suggests I have done something to my .git directory.


Solution

  • This seemed to fix it:

    1. Pushing the changes to another local clone (the beauty of DVCS),
    2. then pushing to the central,
    3. then in the original clone, pulling from central
    4. and pushing again.

    I'm not sure why, but it works now.