Why can't I push my new branch?

git, git-branch, github

Solution

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.

Problem

I made a new branch, checked it out and made a commit: ``` git branch my-branch [HASH] git checkout my-branch git commit -am "Add some stuff to my new branch" ``` However, I can't push it to github. `git push origin my-branch` returns: ``` error: src refspec branch does not match any. error: failed to push some refs to 'https://github.com/Me/my-project.git' ``` `git show-refs` looks like this: ``` [HASH] refs/heads/my-branch [HASH] refs/heads/master [HASH] refs/heads/some-branch [HASH] refs/remotes/origin/master [HASH] refs/remotes/origin/some-branch [HASH] refs/stash ``` What do I need to do?

Original source

Related problems