0

I am trying to git push a new branch I have been working on. This is not the first time I'm pushing to the repo (hosted on assembla) and had no issues before.

I created a new branch, committed and tried to git push --set-upstream origin my-new-branch, and got this message:

fatal: my-new-branch cannot be resolved to branch.
/usr/bin/git-receive-pack:71:in `read_line': undefined method `hex' for nil:NilClass (NoMethodError)
         from /usr/bin/git-receive-pack:80:in `read_split'
         from /usr/bin/git-receive-pack:219:in `rewrite_refs_client_wants_to_modify'
         from /usr/bin/git-receive-pack:100:in `block in start'
         from /usr/lib/ruby/2.3.0/open3.rb:205:in `popen_run'
         from /usr/lib/ruby/2.3.0/open3.rb:95:in `popen3'
         from /usr/bin/git-receive-pack:95:in `start'
         from /usr/bin/git-receive-pack:251:in `<main>'

I also tried to branch off develop to a new branch, recreate the commits manually and pushed from there - but I'm still getting the same error.

Yet, I can still push new changes to other branches that I've created 2 days ago, from the same env. I verified, and the remote has my changes.

I'm working on -

 Windows 10 VM in VirtualBox
 VirtualBox:  version 5.1.2
 git version 2.9.0.windows.1
 shell: windows Git Bash

Please let me know if additional info is required. Was not sure what might be relevant to this problem.

Thanks

ToT
  • 491
  • 3
  • 5

1 Answers1

0

Could it be that you write my-new-branch instead of My-New-Branch? If the system is case sensitive they wouldn't match, and lower-case master is the default in most repositories.

Edit

As per our discussion in comment section of this answer. I have found that Feature/footer was not there on remote. Hence you have to create to create and push into the origin. This can be done in single line by git push -u Feature/footer

Shravan40
  • 8,922
  • 6
  • 28
  • 48
  • Hi @Shravan40, thanks for your reply. I named my branch `feature/footer` and was trying to push it as `git push --set-upstream origin feature/footer` . No issues with upper/lower-case – ToT Aug 02 '16 at 11:32
  • @ToT : Does `git branch -r` list `feature/footer` branch ? – Shravan40 Aug 02 '16 at 11:46
  • when I do `git branch -r` I don't get the new branch on the list. But when I do `git branch -a` I can see it. And now it appears as `Feature/footer`, which I cannot explain, because I can still scroll up in the terminal and see the command that I was using to create the branch `git checkout -b feature/footer`. Why would git list the branch with an upper-case `F` instead of the lower-case `f` ? – ToT Aug 02 '16 at 12:30
  • @ToT : Try `git push -u feature/footer` . – Shravan40 Aug 02 '16 at 12:31
  • Hi @Shravan40 I tried that as well. I took your first comment and started testing the different options. Eventually `git push -u Feature/footer` worked. I still have no idea why though... I checked again and again and when I named the branch I used a lowercase `f` . Any ideas on how to avoid this in the future? or to suggest an explanation to what might have happened ? Thank you – ToT Aug 02 '16 at 13:25
  • @ToT : I don't know why this is happening with you. I tried the same thing and it worked for me http://pastie.org/10927058 . Is there any branch of name `Feature` ? – Shravan40 Aug 02 '16 at 13:46
  • Hi @Shravan40, there is no branch that is called only `Feature`. But we did create 2 branches that start with this word before creating the latest `footer` branch. Both branches have uppercase `F` at the beginning of the word `Feature`. Would git prevent us from having 2 branches that start with the same word, but in different casing ? – ToT Aug 06 '16 at 15:02