mirror-repository (838B) - raw
1 #!/usr/bin/env bash 2 3 # you should never call this script from a non-public repository, but just in 4 # case... 5 if [ ! -f "git-daemon-export-ok" ] || [ ! -f "category" ]; then 6 exit 1 7 fi 8 9 set -e 10 11 eval $(ssh-agent -s) 12 ssh-add /srv/git/.ssh/id_ed25519_sourcehut 13 14 trap "notify \"ERROR pushing $repo\" \"There was an error pushing $repo to either SourceHut or Codeberg.\"" ERR 15 16 dir="$(pwd)" 17 repo="$(basename "$(pwd)" ".git")" 18 19 git -C "$dir" remote get-url srht || \ 20 git -C "$dir" remote add srht "git@git.sr.ht:~hwchen/$repo" 21 git -C "$dir" push --all --force --prune srht 22 git -C "$dir" push --tags --force --prune srht 23 24 #git -C "$dir" remote get-url codeberg || \ 25 # git -C "$dir" remote add codeberg "git@codeberg.org:hwchen/$repo" 26 #git -C "$dir" push --all --force --prune codeberg 27 #git -C "$dir" push --tags --force --prune codeberg