Rename Gitea default branch

From XPUB & Lens-Based wiki

On your own computer

Clone the repository

$ git clone <repo>
$ cd <repo>

Rename the default branch

$ git branch -m master main
$ git status

Returns:

On branch main
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean

Push the change

$ git push -u origin main

In Gitea

  • Go to the repository
  • Click "settings"
  • Go to "Branches"
  • Select the renamed branch as the default
  • Click "Update Settings"

On your own computer

Delete the old branch

$ git push origin --delete master