this post was submitted on 07 Jan 2026
3 points (80.0% liked)
Learn Programming
2135 readers
7 users here now
Posting Etiquette
-
Ask the main part of your question in the title. This should be concise but informative.
-
Provide everything up front. Don't make people fish for more details in the comments. Provide background information and examples.
-
Be present for follow up questions. Don't ask for help and run away. Stick around to answer questions and provide more details.
-
Ask about the problem you're trying to solve. Don't focus too much on debugging your exact solution, as you may be going down the wrong path. Include as much information as you can about what you ultimately are trying to achieve. See more on this here: https://xyproblem.info/
Icon base by Delapouite under CC BY 3.0 with modifications to add a gradient
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Check that you're on a new enough version where main is actually the default, not master.
Also, there's no reason why you can't just switch branches? Just create a main branch from whereever (either right at the start after init or at some later point) and push it, then delete master.
Also literally thr first result when googling how to set the default branch name: https://superuser.com/questions/1419613/change-git-init-default-branch-name set it to main manually if it won't do it automatically
E: regarding the errors when pushing to main, I assume you tried
git push origin mainwhile on the master branch. That doesn't work because git only wants to push to same-name branches. However, you can dogit push origin master:main, which means "push this branch master to the remoteoriginand rename it tomain".