git-restrict

simple utility for git repo permission management
git clone https://git.parazyd.org/git-restrict
Log | Files | Refs | README | LICENSE

gen_rules.sh (508B)


      1 #!/bin/sh
      2 
      3 misc="no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty"
      4 
      5 gen_for_keys() {
      6 	while read -r key; do
      7 		if echo "$key" | grep -q '#'; then
      8 			continue
      9 		fi
     10 
     11 		if [ -z "$key" ]; then
     12 			continue
     13 		fi
     14 
     15 		printf 'command="/usr/local/bin/git-restrict %s",%s %s\n' \
     16 			"$@" "$misc" "$key"
     17 	done
     18 }
     19 
     20 # Admin, let's say they don't need "command" guards.
     21 cat keys/user0
     22 
     23 # Users which we want to cap repos for.
     24 repos_user1="some-repository another-repo"
     25 gen_for_keys "$repos_user1" < keys/user1