#Try git show-ref to see what refs you have. Is there a refs/heads/master?#Due to the recent "Replacing master with main in GitHub" action, #you may notice that there is a refs/heads/main. As a result, #the following command may change #from ---> git push origin HEAD:master#to ---> git push origin HEAD:main#You can try git push origin HEAD:master
#as a more local-reference-independent solution. This explicitly states#that you want to push the local ref HEAD to the remote ref master #(see the git-push refspec documentation).
# You are trying to add an empty repository, add something first, like a readmetouch README.md
gitadd README.md
git commit -m"Initial commit"git push --set-upstream origin master
git init
gitadd.git commit -m"first commit"git branch -M main
git remote add origin "_git repository link here_"git push -u origin main
"main" is the usual branch name in Github repos. In some repos, it can be master or some other name
use the following command at that timegit push origin master
Try git show-ref to see what refs you have. Is there a refs/heads/master?
Due to the recent "Replacing master with main in GitHub" action,
you may notice that there is a refs/heads/main.
As a result, the following command may change from git push origin HEAD:master
to git push origin HEAD:main
So try `git push origin main`
### 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
gitadd.## 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 main
### Success! ###
"main" is the usual branch name in Github repos. In some repos, it can be master or some other name
use the following command at that timegit push origin master