1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
#!/bin/sh set -e usage() { printf "usage: git init-shared directory [user...]\n" >&2 exit 1 } add_to_acl() { setfacl -m "d:u:$2:rwx" "$1" setfacl -m "u:$2:rwx" "$1" } test $# -ge 1 || usage dir=$1 shift mkdir "$dir" for user in "$(id -un)" "$@"; do add_to_acl "$dir" "$user" done exec git init --bare "$dir"