[Solved] Error: Src Refspec Main Does Not Match Any


If you get the following error:

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:

git add .

Commit your files:

git commit -m "your commit message"

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

git push origin main

Need a deeper dive?

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