aboutsummaryrefslogtreecommitdiff
path: root/mirror-to-github/mirror-to-github.sh
blob: f831f0c705edca625478e89fba00992c49e37a21 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/env bash
set -euo pipefail

# Input environment:
#   - REPO: The repository path part of the url to mirror, for example: adyxax/www
# Requires a github identity!

WORKDIR="/tmp/$(basename ${REPO})"

cleanup() {
	rm -rf "${WORKDIR}"
}

trap cleanup EXIT

git clone -q "https://git.adyxax.org/${REPO}" "${WORKDIR}"
(cd ${WORKDIR}; git remote add github https://${GITHUB_USER}:${GITHUB_TOKEN}@github.com/${REPO}; git push github --mirror)