blob: 37f819fab2e4e962d39a5bd835947542b3018ee5 (
plain)
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
#!/bin/sh
set -ex
USER=u
DIR=src/anonymous-ssh
HOST=localhost
SSH_ID=~/.ssh/id_ed25519
get_sshfp()
{
(
key="$1"
r="${2:-.}"
dns=$(mktemp) || exit
trap 'rm -rf "$dns"' EXIT
ssh-keygen -r "$r" -f "$key" > "$dns"
exec < "$dns"
while read line
do
set -- $line
if [ "$3 $5" = "SSHFP 2" ]
then
echo "$line"
break
fi
done
)
}
make_test_commit()
{
newfile=newfile.$(date -Ins|tr -d :)
touch "$newfile"
git add "$newfile"
git commit -m "$newfile"
}
[ -e "$SSH_ID" ] || ssh-keygen -t ed25519 -f "$SSH_ID" -P ''
git_namespace=$(set -- $(get_sshfp "$SSH_ID") && echo $6)
ssh -o NoHostAuthenticationForLocalhost=yes $USER@$HOST -- test || true
[ ! -e anonymous-ssh ] || rm -rf anonymous-ssh
export GIT_SSH_COMMAND="ssh -o NoHostAuthenticationForLocalhost=yes -i $SSH_ID"
git clone -v ${USER}@${HOST}:${DIR}
cd anonymous-ssh
make install
git pull --ff-only
make_test_commit
git push -f
make_test_commit
git push
git log -n4
git pull --ff-only
git log -n4
git push
# branch=$(git branch -q --show-current)
# forkname=origin-myfork
# ns_branch=refs/namespaces/$git_namespace/refs/heads/$branch
# git remote add -m "$ns_branch" "$forkname" $(git remote get-url origin)
# git push "$forkname"
# git pull "$forkname" --ff-only "$branch"
exit
|