2

I get the below exception when I try to push my local branch into master

Total 0 (delta 0), reused 0 (delta 0)
remote: error: cannot lock ref 'refs/heads/master': Unable to create '/data/c01/n08/p/vp0664/data/d-41/r-27032041/refs/heads/master.lock': File exists.
remote: 
remote: If no other git process is currently running, this probably means a
remote: git process crashed in this repository earlier. Make sure no other git
remote: process is running and remove the file manually to continue.
  • I get this exception only when pushing the master branch.

  • I get this exception when pushing the master branch even from other computers.

  • I get this exception even when I try to merge dev branch into master on bitbucket website directly not involving the local computer.

Because of the above 3 reasons I don't think it is a issue with my local .git folder. I can't think of what the possible cause is.

I have tried solutions available in answers to similar exceptions, but all of them are about cleaning/purging/manipulating the files in the .git folder but I get this same issue even from different computers and even on the bitbucket portal itself.

Please vote for the issue, if you are hitting it as well.

PS: I am using the bitbucket.org cloud hosted option.

danglingpointer
  • 4,708
  • 3
  • 24
  • 42
Sudarshan
  • 8,574
  • 11
  • 52
  • 74
  • What happened when you rebased? As described in: https://stackoverflow.com/questions/11228436/failed-to-lock-refs-heads-master – Edwin Nov 14 '17 at 08:27
  • @SketchyCoder get the same error on the step 4 of that answer ```git push origin master:master``` – Sudarshan Nov 14 '17 at 08:32
  • Interesting! It might also help to re-add the remote url (https://stackoverflow.com/questions/6656619/git-and-nasty-error-cannot-lock-existing-info-refs-fatal) but as Edward posted Bitbucket should know the answer. – Edwin Nov 14 '17 at 09:25
  • I have given that a go. Get the same error. – Sudarshan Nov 14 '17 at 09:30
  • Does the file `/data/c01/n08/p/vp0664/data/d-41/r-27032041/refs/heads/master.lock` existing in your git server? – Marina Liu Nov 16 '17 at 09:24

1 Answers1

0

Indeed, this problem is not with your computer, it is with the server. This error message is actually coming from your Git server (note the prefix remote to the message, this indicates that the error originates on the server.)

If this was your own server with its own Git installation, I would advise you to make sure that there is no long-running Git process doing work and - if there wasn't - removing the lock file it's referring to since a process had indeed crashed.

Since you're running Bitbucket, however, it's probably best to ask them for support instead of changing things on the server directly.

Edward Thomson
  • 74,857
  • 14
  • 158
  • 187