Skip to content

Cannot push to main but can push to master #22512

Discussion options

You must be logged in to vote

The difference is the name: Your local branch is called master, the remote one main. By default git push origin <branch> will push that branch to a remote branch of the same name. If you really want to you can override that and explicitly push from your local master to remote main:

git push origin master:main

However, it might be much easier to rename your local branch to match the remote one:

git branch -m master main

Replies: 9 comments 4 replies

Comment options

You must be logged in to vote
1 reply
@avajscript
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@Gaalpos
Comment options

@Sulphite05
Comment options

@beelalamin
Comment options

Answer selected
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
10 participants