István Engineering

Changing the Default Branch from Main to Master on GitHub

In empty repositories

git branch -M master
# Make your initial commit
git commit
git push -u origin master

In non-empty repositories

Navigate to your repository on GitHub and follow these steps:

  1. Go to your repository's main page
  2. Click on Settings (requires admin access)
  3. Under "Default branch", click the switch icon or pencil icon
  4. Type master in the textbox
  5. Click Rename branch