If you get the following error:

1
2
error: src refspec main does not match any
error: failed to push some refs to 'https://github.com/ao/xxx.git'

This is because you probably haven’t committed any files to git yet!

Fix for: src refspec main does not match any

Make sure to add your files, if they have not been added yet:

1
git add .

Commit your files:

1
git commit -m "your commit message"

Push your changes to the git repo, remember to swap out the branch name as appropriate:

1
git push origin main

Need a deeper dive?

For more in depth information, you can visit Solved Error src Refspec Main Does Not Match