[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'
Code language: plaintext (plaintext)

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

How to fix this

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

git add .
Code language: Bash (bash)

Commit your files:

git commit -m "your commit message"
Code language: Bash (bash)

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

git push origin main
Code language: Bash (bash)
Tags:
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments