I just created a new repo and it had the "main" branch as the default branch. When I try to push to main I get the following error
error: failed to push some refs to
However, if I create a new branch master, I can push to it without any problem.
I just created a new repo and it had the "main" branch as the default branch. When I try to push to main I get the following error
error: failed to push some refs to
However, if I create a new branch master, I can push to it without any problem.
For your first push, assuming your are on the local branch main yourself, you would do:
git push -u origin main
If you are on a local master
branch:
First, make sure any new local repository is created with the default branch "main
" (see init.defaultBranch
)
Second, rename your master
branch as main
git branch -m master main
Then the git push -u origin main
will work.