Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Notorious Git Error: remote rejected (failed to lock)

Tags:

git

github

I am trying to push to a branch from my local to the origin. The branch name and the path is same. I have been pushing and pulling from this branch for a while and never had a problem. But suddenly, it started behaving badly. Last time when I tried to push to origin with following command:

git push origin feature/Prizefulfilment 

It gives me following errror:

72c6c1da98e5cff4484e254a538d9e3b472156ff but expected 0000000000000000000000000000000000000000 

I have Googled around but did not find a quite satisfying solution to it yet.

My exact error looks like following:

$ git push origin feature/Prizefulfilment Counting objects: 126, done. Delta compression using up to 4 threads. Compressing objects: 100% (75/75), done. Writing objects: 100% (78/78), 8.83 KiB, done. Total 78 (delta 61), reused 0 (delta 0) error: Ref refs/heads/feature/Prizefulfilment is at 72c6c1da98e5cff4484e254a538d9e3b472156ff but expected 0000000000000000000000000000000000000000 remote: error: failed to lock refs/heads/feature/Prizefulfilment To [email protected]:OpusOneSCRUM  ! [remote rejected] feature/Prizefulfilment -> feature/Prizefulfilment (failed to lock) error: failed to push some refs to '[email protected]:OpusOneSCRUM'` 

Any ideas?

like image 706
Lost Avatar asked Sep 14 '12 00:09

Lost


1 Answers

 git push feature/prizeFulfilment: feature/Prizefulfilment 

That is similar to this answer:

For the record, I believe the root cause of this problem was the difference in capitalisation between the local and remote branch names, and the case-insensitive nature of the Windows share that hosted the remote repository.

We just encountered this exact same error and were able to resolve the problem simply by renaming the local branch to match the capitalisation of the existing remote branch.

Try and make sure to use the same capitalization between local and remote branches.

You second command make the link between the prizeFulfilment and remote Prizefulfilment explicit, which is why it worked. But it isn't a good solution to keep a local branch with that kind of difference.

like image 112
VonC Avatar answered Sep 18 '22 12:09

VonC