git-trace

romele / git-trace public

62 commits · 1 branch · 1 tag · 1 contributor (top: Romele) · first commit 3d ago · last push 6m ago

scripts/dev-ssh.sh

#!/bin/bash
# dev-ssh.sh — runs as root inside the git-trace-ssh test container.
# Sets up forge state as OS user 'git', then starts sshd with the
# generated authorized_keys file.
set -ex
export GIT_TRACE_REPOS=/srv/repos GIT_TRACE_DB=/srv/var/git-trace.db

su git -s /bin/bash -c "
  export GIT_TRACE_REPOS=/srv/repos GIT_TRACE_DB=/srv/var/git-trace.db
  echo secretpw1 | /src/git-trace useradd alice
  echo hunter22  | /src/git-trace useradd bob
  /src/git-trace mkrepo alice demo 'demo over ssh'
  /src/git-trace mkrepo bob   work 'bob repo'
  /src/git-trace sshkey add alice --name laptop < /src/var/testkey.pub
  /src/git-trace keyfile --write
  git config --global user.email a@x
  git config --global user.name a
  git init -q /tmp/seed
  cd /tmp/seed
  echo hi > f.c
  git add -A
  git commit -qm init
  git push -q /srv/repos/alice/demo.git master
"

ssh-keygen -A >/dev/null
/usr/sbin/sshd -o AuthorizedKeysFile=/srv/var/authorized_keys \
               -o PasswordAuthentication=no -o PermitRootLogin=no