Why can't I push my new branch? Why can't I push my new branch? git git

Why can't I push my new branch?


Here is the command you would execute to push all of the changes from your local branch ("my-branch") to a "my-branch" branch on the GitHub repository:

git push -u origin my-branch


The branch doesn't exist on github, when you push git checks the refs of origin for your branch and doesn't find it.

Add the branch as a remote branch:

git 1.8.x

git branch -u origin/my-branch my-branch

git 1.7.x

git branch --set-upstream my-branch origin/my-branch

Now you can push.


There is an error in command line parsing. As you can see in this message:

error: src refspec branch does not match any.

git tries to push a branch with the name branch, not my-branch. What OS/shell are you running? Maybe try

git push origin "my-branch"