Error Message on <git push -u origin main> Command when trying to push an existing repository to GitHub

I am struck on step #6 of “Your first remote repository on Github” at the following link:

The first two commands seem to work but when I enter the <git push -u origin main> command in Git Bash I receive the following error message:

$ git push -u origin main
error: src refspec main does not match any
error: failed to push some refs to ‘


1 Like


Make sure you’ve committed at least one change before trying to push the repo up to GitHub. Usually you get this error when you initialize the repository and try to push it before making a commit.

1 Like