diff options
Diffstat (limited to 'hooks/post-receive')
-rwxr-xr-x | hooks/post-receive | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/hooks/post-receive b/hooks/post-receive index 4e85b42..67e7610 100755 --- a/hooks/post-receive +++ b/hooks/post-receive | |||
@@ -4,5 +4,34 @@ then | |||
4 | GIT_WORK_TREE=. git checkout -f master -- hooks/post-receive | 4 | GIT_WORK_TREE=. git checkout -f master -- hooks/post-receive |
5 | DID_SELF_UPDATE=y exec hooks/post-receive | 5 | DID_SELF_UPDATE=y exec hooks/post-receive |
6 | fi | 6 | fi |
7 | exec >&2 | ||
7 | 8 | ||
8 | echo 'Hello, world!' >&2 | 9 | GIT_WORK_TREE=. git checkout -f master -- authorized_keys.d/\* |
10 | |||
11 | if [ "$SSH_USER_AUTH" ] && [ -f "$SSH_USER_AUTH" ] | ||
12 | then | ||
13 | read authtype keytype keyval < "$SSH_USER_AUTH" | ||
14 | [ "$authtype" = publickey ] || exit | ||
15 | |||
16 | user= | ||
17 | for keyname in authorized_keys.d/* | ||
18 | do | ||
19 | while read a b _ | ||
20 | do | ||
21 | case "$a $b" in | ||
22 | "$keytype $keyval") | ||
23 | user=${keyname#authorized_keys.d/} | ||
24 | break | ||
25 | ;; | ||
26 | esac | ||
27 | done < "$keyname" | ||
28 | done | ||
29 | |||
30 | if [ "$user" ] | ||
31 | then | ||
32 | echo "user=$user" | ||
33 | fi | ||
34 | |||
35 | else | ||
36 | echo "\$SSH_USER_AUTH missing. Try putting 'ExposeAuthInfo yes' in /etc/ssh/sshd_config" | ||
37 | fi | ||