“src refspec does not match” and “failed to push some refs” errors on git push

Possible Duplicate:
Error when “git push” to github

I tried to push my new branch (let’s just call it new_branch) to remote rep. There is no such branch there yet, but git push origin new_branch:new_branch should create it. When I try to do it, this is what I get:

  • How to git cherrypick all changes introduced in specific branch
  • git pull from branch complains about which branch to merge with
  • how to merging works with git
  • Maven cannot find .git (dotGitDirectory)
  • Is there any way to get the SHA of a commit from its message?
  • How do I tell 'git tag -s ..' (or -u) where my private key is (Windows 7)?
  • error: src refspec new_branch does not match any.
    error: failed to push some refs to 'ssh://git@***'

    I dug through million of questions like this on SO, but none of them specified these two errors at once and they referred only to master branch (I don’t know if it makes any difference).

    What I already tried include commit, reset and push in many configurations. And they didn’t work so far. I suppose there may be some issue with HEAD, because I messed with it some time ago. But it’s a guess and I don’t even know how to check it properly, since GIT is still a teeny-tiny mystery for me.

    So – how can I get rid of these errors and push my local branch to remote repository?

  • how to rewrite history to remove executable bit in git
  • Should I gitignore my .gitignore?
  • Submodule libraries in git to minimize redundancy
  • What's the *right* way to apply a patch from another branch?
  • git-clone fatal, permission denied
  • Very basic git batch in Windows 7
  • One Solution collect form web for ““src refspec does not match” and “failed to push some refs” errors on git push”

    The syntax you’re using for git push includes a refspec (new_branch:new_branch). Refspecs are always in the form source:destination, so the error is telling you that something’s wrong with the source part of your refspec.

    I was able to reproduce this error by trying to push a branch that doesn’t exist (git push origin fake:fake). I know this seems like a painfully stupid question, but are you sure you’re spelling your branch name correctly? Keep in mind that branch names are case-sensitive. What do you see when you type git branch?

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