Pushing to remote branch

I have a git problem/question.

We are using bitbucket as our remote repo. Until now we’ve only had the master branch.

  • What is the state of distributed bug tracking?
  • git:// protocol blocked by company, how can I get around that?
  • GIT Fatal : refusing to merge unrelated histories
  • Wildcards in branch names specification in “git merge”
  • Installing Git and Mercurial on the same machine
  • How to show git log history for a sub directory of a git repo?
  • The other person I’m working on this with created a “develop” branch now the project is live for us to continue working on.

    I’ve been working locally and have made changes and commited them.

    I now want to push these to the remote “develop” branch.

    I thought that

    git push origin develop

    would do it but i get

    error: src refspec develop does not match any.

    What does this mean?. I can see that the develop branch does indeed exist so what am I doing wrong?

    Thanks so much for your help!

  • Change branch parent
  • automated deployment from bitbucket to iis on windows server
  • Amend a commit that wasn't the previous commit
  • fatal: bad object HEAD
  • How can I save a git “rebase in progress”?
  • git fetch shows nothing on console
  • 5 Solutions collect form web for “Pushing to remote branch”

    Thanks for your answers, I’ve got things working again.

    For anyone interested this is how I did it.

    I did a

    git pull origin master

    and that updated my local repo and it was now aware there was a remote develop branch

    I then did

    git checkout develop

    to switch to my local develop branch.. then

    git merge master

    to merge all the changes I had done in master into the develop branch
    Then doing

    git push origin develop

    worked fine.

    Now all my changes are safe in the develop branch I can revert the master branch (where I was working) so it’s the same as the remote master branch and everything is as it should be.

    Not sure If that was the easiest way to go about it but I learned a lot about git.

    Thanks again for your answers.

    develop exist in where? local? remote? or both? Try:

    git push origin HEAD:develop

    If you use

    git push <repo> <src>

    git push origin develop

    then git expects to find a local branch called ‘develop’ that it can take to push to a remote branch of the same name. Since there is no local branch of that name you get the error.

    So, if you want to push to a new (or existing) remote branch that has a different name locally then you would do the following:

    git push <repo> <src>:<dst>


    git push origin master:develop

    That should work. *checks*. It does.

    You have not yet pulled develop from the server. You have a remote develop branch, but you do not have a local develop tracking branch.

    git checkout develop

    This will create the local develop tracking branch.

    If you already committed your changes, those changes are on the master branch that you were using before. Moving those changes to the develop branch is a bit more complicated.

    Moving those changes can be explained once we’ve identified the problem that you are actually having.

    Did you forget to commit your work? This happens when you clone an empty repo, add files but forget to commit them before pushing.

    Git Baby is a git and github fan, let's start git clone.