Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git push not working but git pull does work on remote branch

Tags:

git

github

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: [email protected]:myorg/my-repository.git
  Push  URL: [email protected]: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

like image 515
pbattisson Avatar asked Dec 09 '11 14:12

pbattisson


2 Answers

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.

like image 78
etayluz Avatar answered Nov 08 '22 05:11

etayluz


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
like image 40
Daniel Elliott Avatar answered Nov 08 '22 06:11

Daniel Elliott