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:

https://www.codecademy.com/courses/learn-git/articles/f1-u3-git-setup

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 ‘https://github.com/danielduehren/git_practice.git

Thanks.

1 Like

@danielduehren,

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