Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"failed to lock" error

I need some help resolving an error when I push a branch from my local repo to a thumb drive. I believe the problem was caused by switching back and forth between different drives. In particular, I lost one and started using a replacement. Then when I found the original I switched back to it. Now it seems some of my refs/heads are messed up. For example, I get the following output when I try to push a branch:

$ git push origin android-lite 
Counting objects: 111, done.
Compressing objects: 100% (98/98), done.
Writing objects: 100% (109/109), 29.63 KiB, done.
Total 109 (delta 40), reused 0 (delta 0)
error: unable to resolve reference refs/heads/android-lite: No such file or directory
remote: error: failed to lock refs/heads/android-lite
To /media/2AC0-E4E2/devel/src/java/bbct/
 ! [remote rejected] android-lite -> android-lite (failed to lock)
error: failed to push some refs to '/media/2AC0-E4E2/devel/src/java/bbct/'
$ 

If I understand correctly, this says that refs/heads/android-lite doesn't exist in origin. However, I'm confused why git doesn't create a new branch. Is there something in my local repo that indicates that the android-lite branch already exists in origin?

like image 935
Code-Apprentice Avatar asked Dec 31 '12 23:12

Code-Apprentice


1 Answers

If debugging the remote repo is too complex (as in this question, with git gc, git prune, git fsck, ...)), you still can:

  • git bundle your current repo, that will give you only one file,
  • copy that one file on the remote drive
  • git clone from that bundle file
  • set your current remote address to that new path

This is a bit like "How to synchronize two git repositories", and using a bundle for this task is to make sure you don't have any file error copy.

like image 74
VonC Avatar answered Oct 10 '22 07:10

VonC