all repos

mugit @ 3d4f6c6

🐮 git server that your cow will love

mugit/testscript/ssh-push.txtar (view raw)

Oleksandr Smirnov Oleksandr Smirnov
olexsmir@gmail.com
ssh: print modt on ssh -T, 28 days ago
1
git init local
2
cp file.txt local/file.txt
3
git -C local add file.txt
4
git -C local commit -m initial
5
6
mugit repo new ssh-push
7
8
exec env GIT_SSH_COMMAND=$SSH_WRAPPER git -C local push git@localhost:ssh-push.git master
9
stderr 'Welcome to test mugit!'
10
11
exec git clone $MURL/ssh-push verify-clone
12
exists verify-clone/file.txt
13
exec cat verify-clone/file.txt
14
stdout 'hello from ssh'
15
16
17
# auto initializing on first push
18
git init local2
19
cp file.txt local2/file.txt
20
git -C local2 add file.txt
21
git -C local2 commit -m initial
22
23
24
exec env GIT_SSH_COMMAND=$SSH_WRAPPER git -C local2 push git@localhost:auto-init master
25
stderr 'info: auto-initializing auto-init'
26
exists $REPOS/auto-init.git/HEAD
27
28
# subsequent pushes should not re-initialize
29
cp file2.txt local2/file2.txt
30
git -C local2 add file2.txt
31
git -C local2 commit -m second
32
33
exec env GIT_SSH_COMMAND=$SSH_WRAPPER git -C local2 push git@localhost:auto-init master
34
! stderr 'auto-initializing auto-init'
35
36
37
# verify pushed content is available
38
exec env GIT_SSH_COMMAND=$SSH_WRAPPER git clone git@localhost:auto-init verify-auto-init
39
exists verify-auto-init/file.txt
40
exists verify-auto-init/file2.txt
41
42
43
# should print MOTD for ssh -T style connections
44
exec $SSH_WRAPPER ignored
45
stderr 'Welcome to test mugit!'
46
47
48
# should not allow execution of commands
49
! exec $SSH_WRAPPER ignored 'echo hi'
50
stderr 'access denied:'
51
52
# should not accept command chaining after git command
53
! exec $SSH_WRAPPER ignored 'git-receive-pack auto-init.git && echo hi'
54
stderr 'access denied: invalid command'
55
56
57
-- file.txt --
58
hello from ssh
59
60
-- file2.txt --
61
hello second push