Default branch named "master" despite my account preferences #60619
Replies: 2 comments 1 reply
-
|
This issue occurs because when you create a new repository and clone it, Git uses the default branch name specified by its own configuration, not the default branch name set in GitHub repository settings. To avoid this annoyance in the future, you can follow these steps: The first command renames the branch locally, and the second command pushes the renamed branch to the remote repository on GitHub. By following these steps, you will ensure that the default branch in both your local repository and the remote repository on GitHub is named "main." |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
-
I've confirmed that my default branch is set to

main:However, when I create a new repo (via the New Repository button in the top right, on GitHub) and clone it, I've discovered that the default branch is still named
masteranyway!git status returns:

git push origin "main"doesn't work to push changes; I need to usemaster.I've renamed it using the sequence:
git branch -m master maingit fetch origingit branch -u origin/main maingit remote set-head origin -aafter renaming it from GitHub, but... why is this happening when I've set up GitHub to name the default branch
main? As is probably apparent, I'm pretty new to git, and I'm sure I'm missing something dumb here, but if there's any way to avoid this annoyance in the future, I'd love to find out. Thanks!Beta Was this translation helpful? Give feedback.
All reactions