src refspec ~ does not match any

kwony picture kwony · Nov 2, 2014 · Viewed 51.1k times · Source

Hi I want to push something to specific remote branch

I make local areas by

git clone https://~~~.Something
cd https://~~~.Something

and I can access specific branch using

git checkout origin/[branch]

I want to commit something to my specific branch origin/[branch] But when I am trying to push something using by

git push origin [branch]

I got this error

error: src refspec [branch] does not match any.
error: failed to push some refs to 'https://github.com/kkammo/yonseitree.git'

I tried to solve this problem but I can't find any solution... so plz help me T.T

Answer

Luna Kong picture Luna Kong · Mar 24, 2015

A replicated question here, src refspec master does not match any when pushing commits in git

Try git show-ref to see what refs do you have. Is there refs/heads/[branch]?

You can try git push origin HEAD:[branch] as more local-reference-independent solution.

It works for me.