Error: src refspec main does not match

Can’t push to the main branch. Default Branch is main now.

image

Image: https://imgur.com/a/xlf2Pcz

ninja@ninja:~/Scripts/nodejs-api$ git push origin main
error: src refspec main does not match any
error: failed to push some refs to 'https://github.com/mcnaveen/API'

Do you have a local main branch, too? The error message sounds like you don’t.

Solved by running git checkout -b main then git push origin main

You saved me @airtower-luna Thanks.

1 Like