mirror-repository (760B) - 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 trap "notify \"ERROR pushing $repo\" \"There was an error pushing $repo to either SourceHut or GitHub.\"" ERR 12 13 dir="$(pwd)" 14 repo="$(basename "$(pwd)" ".git")" 15 16 git -C "$dir" remote get-url srht || \ 17 git -C "$dir" remote add srht "git@git.sr.ht:~ob/$repo" 18 git -C "$dir" push --all --force --prune srht 19 git -C "$dir" push --tags --force --prune srht 20 21 git -C "$dir" remote get-url github || \ 22 git -C "$dir" remote add github "git@github.com:oscarbenedito/$repo" 23 git -C "$dir" push --all --force --prune github 24 git -C "$dir" push --tags --force --prune github