If gitcreate as ran as root, it can restart itself using sudo so that it
is ran as the correct repo owner user. This is a convenience change.
githooks=.githooks
githookspath="$git_root/$githooks"
githooks=.githooks
githookspath="$git_root/$githooks"
+# If running as root, rerun via sudo as user $owner to ensure proper permissions
+if [ "$(whoami)" == "root" ]; then
+ sudo -u $owner $0 $*
+ exit $?
+fi
+
if [ "$(whoami)" != "$owner" ]; then
echo "$0: must run as user $owner" >&2
exit 1
if [ "$(whoami)" != "$owner" ]; then
echo "$0: must run as user $owner" >&2
exit 1