Skip to main content

Migrate Github Repository to Gitea


GITHUB_AUTH_TOKEN=1234
GITEA_AUTH_TOKEN=5678
GITEA_URL=https://git.example.com
_payload=$(mktemp)

cat <<EOF > ${payload}
{
"auth_token": "${GITHUB_AUTH_TOKEN}",
"clone_addr": "https://github.com/tiredofit/$1.git",
"issues": true,
"pull_requests": true,
"private": false,
"repo_name": "$1",
"repo_owner": "tiredofit",
"service": "github"
}
EOF

curl -k -X POST "${GITEA_URL}/api/v1/repos/migrate" \
    -H "accept: application/json" \
    -H "Authorization: token ${GITEA_AUTH_TOKEN}" \
    -H "Content-Type: application/json" -d @${_payload} -i

rm -rf "${_payload}"