How to make git default branch to “main”

It no “master” branch at all in Github. So my local git server also need “main” branch.

favicon valley
May 14, 2021

Easy way to make it happen just change default template for git — init

  • My Ubuntu server the default template directory:
/usr/share/git-core/templates
  • Mac:
/usr/local/git/share/git-core/templates

Just add file name HEAD and put simple line

ref: refs/heads/main

Done :)

--

--