aboutsummaryrefslogtreecommitdiff
path: root/roles
diff options
context:
space:
mode:
authorJohannes Stoelp <johannes.stoelp@gmail.com>2023-01-03 21:24:49 +0100
committerJohannes Stoelp <johannes.stoelp@gmail.com>2023-01-03 21:24:49 +0100
commit5865d893c3942077d7d3706a8cfdec36452221e9 (patch)
tree8dc2e597b4caa89f3a2d954b2aedfc623f303420 /roles
parentc994b9baaabea481d06bf80fbb19dc43dd1ec9cc (diff)
downloadansible-memzero-5865d893c3942077d7d3706a8cfdec36452221e9.tar.gz
ansible-memzero-5865d893c3942077d7d3706a8cfdec36452221e9.zip
git: change default branch name to main
Diffstat (limited to 'roles')
-rwxr-xr-xroles/git/files/gitolite-cgit/entrypoint.sh6
1 files changed, 6 insertions, 0 deletions
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'