I clone my repository with:
git clone ssh://xxxxx/xx.git
But after I change some files and add
and commit
them,
This happens when you have added your file, forgot to commit and pushing. So commit the files and then push.
Maybe you just need to commit. I ran into this when I did:
mkdir repo && cd repo
git remote add origin /path/to/origin.git
git add .
Oops! Never committed!
git push -u origin master
error: src refspec master does not match any.
All I had to do was:
git commit -m "initial commit"
git push origin master
Success!
This happens too when you are in a specific branch and try to push another branch that does not exist yet, like:
$ git branch
* version-x # you are in this branch
version-y
$ git push -u origin master
error: src refspec master does not match any.
error: failed to push some refs to 'origin_address'
My issue was that the 'master' branch hadn't been created locally yet.
A quick
git checkout -b "master"
created the master branch, at which point, a quick
git push -u origin master
pushed the work up to the Git repository.
git add .
git commit -m "message"
git push origin branch
Please check for spelling mistakes because that could also give that error.
You probably forgot the command "git add ." after the "git init" command.