9

One of the developers in my team is having the following issues. They have the ability to pull a remote branch which says it is all up to date, but they cannot push to that remote branch. The following is what they are getting in the Windows git command prompt

MY@MY-PC ~/documents/workspace/my-repository (workflowNewCOBRequest1)
$ git remote show origin workflowNewCOBRequest1
Enter passphrase for key '/c/Users/MY/.ssh/id_rsa':
* remote origin
  Fetch URL: git@github.com:myorg/my-repository.git
  Push  URL: git@github.com:myorg/my-repository.git
  HEAD branch: master
  Remote branches:
    2_Initial_COB_Submission tracked
    COB_VF_email_template    new (next fetch will store in remotes/origin)
    Team-approval            tracked
    develop                  tracked
    master                   tracked
    testing                  tracked
    workflowNewCOBRequest1   tracked
  Local branches configured for 'git pull':
    develop                merges with remote develop
    master                 merges with remote master
    workflowNewCOBRequest1 merges with remote workflowNewCOBRequest1
  Local refs configured for 'git push':
    Team-approval pushes to Team-approval (up to date)
    develop       pushes to develop       (local out of date)
    master        pushes to master        (up to date)

MY@MY-PC ~/documents/workspace/my-repository (workflowNewCOBRequest1)
$ git push origin workflowNewCOBRequest1
Enter passphrase for key '/c/Users/MY/.ssh/id_rsa':
fatal: workflowNewCOBRequest1 cannot be resolved to branch.
fatal: The remote end hung up unexpectedly

I have searched the internet and cannot find anything resembling this. Any ideas?

Thanks

Paul

Kon
  • 4,023
  • 4
  • 24
  • 38
pbattisson
  • 1,230
  • 2
  • 10
  • 24

3 Answers3

13

I had a similar problem using an old version of git

try

git version

and compare with someone who is not having the issue

Although, here it looks like the problem is that you don't have a local REF for pushing that branch back to the origin.

Does this work? It explicitly indicates which branch to push to (and from)

git push origin workflowNewCOBRequest1:workflowNewCOBRequest1
Daniel Elliott
  • 22,647
  • 10
  • 64
  • 82
  • Edited .. think problem is no REF for pushing that branch (trying to find a fix for you now!) – Daniel Elliott Dec 09 '11 at 15:18
  • That command did do something saying it was all upto date but I have found out he has knackered his repo up in all manner of ways anyway (not following instructions ;-)) Thanks for the help though! – pbattisson Dec 09 '11 at 15:44
2

I spent an hour trying all sorts of stuff - nothing worked to get rid of the error. Finally, I decided to delete the local repo - and clone the remote repo again. Then everything started working just fine. Not ideal - but will work.

etayluz
  • 15,920
  • 23
  • 106
  • 151
0

Depeding on the repository, you might be required to create a new branch before you can push . I was on the master branch and had to create a new brach from my last commit . How to create a new branch from a previous commit

That worked for me.

Community
  • 1
  • 1
Gregor
  • 358
  • 2
  • 7