--- /dev/null
+#! /bin/sh
+# See https://stackoverflow.com/a/69193032/7976758
+
+set -e
+git config core.sharedRepository group
+
+# Fix group
+chgrp -R $1 . # Use desired group name
+
+# Fix file/directory permissions throughout the entire tree
+chmod -R ug+rwX . # Please note **uppercase** X
+
+# Make FS to inherit group on creating subdirectories or files
+find . -type d -exec chmod g+s '{}' \+
+
+# Git object DB files are read-only
+find .git/objects -type f -exec chmod ug=r '{}' \+
+