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: [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

3 Answers 3

14

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
Sign up to request clarification or add additional context in comments.

2 Comments

Edited .. think problem is no REF for pushing that branch (trying to find a fix for you now!)
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!
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.

2 Comments

I could do this, but I have many local commits which are not pushed to remote.
I guess this was my hint. I cloned the repository to a new directory and copied the files from the old one on top and presto :) Except the .git stuff of course.
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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.