0

I already have local git repository. I've commited 2 times there.

But when I'm trying to push the code to Github. It is showing me an error.

(I've already authanticated Github )

git remote add origin https://github.com/upsharwan/learngit.git git branch -M main git push -u origin main

When I'm using push - u origin main then it says

Everything up-to-date branch 'main' set up to track 'origin/main'.

When I'm using push -u origin master then it says

error: src refspec master does not match any error: failed to push some refs to 'https://github.com/upsharwan/gitlearn.git'

Screenshot of terminal

  • 4
    Since you're new to git, "master" branch doesn't exist anymore (for most new repos). That is why you get an error message there. The new name is "main". The reason you get "Everything up-to-date" means that you don't have any changes locally which you can push to your repository. This might be because you forgot to add the changes or you didn't change anything. If you want to see if you've any changes you can use `git status` – Kevin Jul 14 '22 at 12:42
  • https://stackoverflow.com/search?q=%5Bgit%5D+error%3A+src+refspec+master+does+not+match+any – phd Jul 14 '22 at 13:39

0 Answers0