a blog for those who code

Tuesday, 8 July 2014

Error when "git push" : src refspec test does not match any

You might be getting and error like...

error : src refspec test does not match any.
fatal : The remote end hung up unexpectedly
error : failed to push some refs to 'git@github.com: {username}/{projectname}.git'
So, In this post we will try to fix this error, we have some solution regarding 'error : src refspec test does not match any'. So, lets list down the solutions..

Solution 1 :

At first just try to commit all the files before pushing it into the github. This error will come when you haven't committed the files and tried to push to the github.

If this also doesn't worked out for you, lets move to 2nd solution.

Solution 2 :

If you are working with branches and getting this error then might be you are not refrencing to the correct branch. Refspec are always in the form source:destination, so the error is telling you that might be something is wrong with your source part. If you are doing a spelling mistake or changing the case of the branch, you will get this error because branch names are case-sensitive.

Solution 3 :

If above two solution doesn't worked for you then you can try using :

git push origin HEAD:master
OR
git push origin "your_git_repo":"your_branch_name"
OR
git push origin master --force

So these three solution will surely make your "git push" work but if it doesn't just check that you are trying to push a specific branch in local to a specific branch in remote. This error will also come when you are in a specific branch and try to push another that do not exist yet.

Please Like and Share the Blog, if you find it interesting and helpful.

No comments:

Post a Comment