Home > OS >  Is the push command now "git push origin master" or "git push origin main"?
Is the push command now "git push origin master" or "git push origin main"?

Time:02-03

I'm new and I'm lost. I read now "master" is renamed to "main" due to its slavery terminology. So I did git push origin main from my PC console and I get the error error: src refspec main does not match any. But my branch is called main not master. So why the error? I've added and committed prior.

CodePudding user response:

You can always check it with the git branch command to confirm.

You can use this command to set Default branch name system wide.
git config --global init.defaultBranch main

CodePudding user response:

It's because there is an error in the connection between git and github, I tried to login to github many times to authenticate in git terminal, but still can't. then I tried in the vscode terminal. At first it didn't work, although I've tried using main and master, they both didn't work. Then after the umpteenth attempt to push, vscode somehow automate the authentication so I can use main to push again.

  •  Tags:  
  • Related