From 5865d893c3942077d7d3706a8cfdec36452221e9 Mon Sep 17 00:00:00 2001 From: Johannes Stoelp Date: Tue, 3 Jan 2023 21:24:49 +0100 Subject: git: change default branch name to main --- roles/git/files/gitolite-cgit/entrypoint.sh | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'roles/git/files') diff --git a/roles/git/files/gitolite-cgit/entrypoint.sh b/roles/git/files/gitolite-cgit/entrypoint.sh index 873a0ac..3ad094f 100755 --- a/roles/git/files/gitolite-cgit/entrypoint.sh +++ b/roles/git/files/gitolite-cgit/entrypoint.sh @@ -21,6 +21,12 @@ if [ ! -f /var/lib/git/.ssh/authorized_keys ]; then echo "${SSH_KEY}" > /tmp/admin.pub su - git -c 'gitolite setup --pubkey /tmp/admin.pub' rm -f /tmp/admin.pub + + # Change default git branch. + # IMPORTANT: + # Only do this after gitolite is initialized, as gitolite only applies + # changes made to the *master* branch in the gitolite-admin repository. + su - git -c 'git config --global init.defaultBranch main' else # Fixup gitolite, eg in case a new repo was added manually. su - git -c 'gitolite setup' -- cgit v1.2.3