7

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?

Code-Apprentice
  • 81,660
  • 23
  • 145
  • 268

1 Answers1

2

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.

Code-Apprentice
  • 81,660
  • 23
  • 145
  • 268
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Thanks for the suggestions. To emphasize one detail in my question: the remote repo is on a thumb drive plugged into my computer. I can easily `cd` directly to the remote repo and manipulate it from there. So if there is a simple solution manipulating the remote directly, I'm all for that. – Code-Apprentice Dec 31 '12 at 23:58
  • @Code-Guru I have linked to the question which explains the command you can try to debug. Regarding my suggestion, I would still use a bundle in order to initialize a clean repo. Or you can clone your local repo directly on said thumb drive. – VonC Jan 01 '13 at 00:00