dotfiles
shell, editor, ssh.
git clone https://owenrusk.dev/dotfiles.git
dotfiles / bin/pushall -rwxr-xr-x · 582 bytes
1 #!/bin/sh
2 # push every repository under ~/src to the code host, making any that aren't there yet.
3 # it serves them over plain http, so each one needs update-server-info after.
4 set -eu
5
6 src=${SRC:-$HOME/src}
7 host=${PUSHALL_HOST:-code}
8 root=${PUSHALL_ROOT:-/srv/git}
9
10 for dir in "$src"/*/; do
11 [ -d "$dir.git" ] || continue
12 name=$(basename "$dir")
13 repo=$root/$name.git
14 printf '== %s\n' "$name"
15 ssh "$host" "test -d '$repo' || git init -q --bare -b main '$repo'"
16 git -C "$dir" push -q "$host:$repo" --all
17 ssh "$host" "git -C '$repo' update-server-info"
18 done