A collection of tools to automate some activities at Github:
- gh-mirror: A tool to mirror Github repositories to Gitea
- gh-starred: A tool to clone starred repositories with x-motemen/ghq
Automates the process of mirroring repositories from Github to Gitea. It supports mirroring both personal repositories and repositories belonging to specific organizations
- Personal repositories: Automatically mirrors personal Github repositories to your Gitea account.
- Organizational repositories: Mirrors repositories from specified Github organizations to corresponding Gitea organizations.
- No duplication: Skips repositories that already exist in Gitea, avoiding duplicate migrations.
To mirror repositories, run the following Docker command:
docker run --rm \
-e GITHUB_USERNAME="changeme" \
-e GITHUB_TOKEN="changeme" \
-e GITEA_URL="changeme" \
-e GITEA_TOKEN="changeme" \
-e ORG_MAPPING='{"abc-org": "abc-org", "other-org": "other-org"}' \
--name=gh-mirror \
ghcr.io/brighteyed/gh-mirror:latest
-
The tool will mirror personal repositories to your Gitea account and organizational repositories to the specified Gitea organizations.
-
If a Gitea organization does not exist, it will be created automatically.
-
Repositories that already exist in Gitea will be skipped.
If your Github token changes, you can update it in all mirrored repositories using the update_token.py
script. Run the following Docker command:
docker run --rm -v "/path/to/gitea/data/git/repositories:/repositories" ghcr.io/brighteyed/gh-mirror:latest update_token.py --old-token="<old_token>" --new-token="<new_token>"
- Replace
/path/to/gitea/data/git/repositories
with the actual path to your Gitea repositories directory.
You can use docker to clone or update starred repositories:
docker run --rm -e GITHUB_TOKEN="changeme" \
-v /path/to/dir:/ghq \
--name=gh-starred \
ghcr.io/brighteyed/gh-starred:latest
GITHUB_USERNAME
– Github usernameGITHUB_TOKEN
– Github personal access tokenGITEA_URL
– Gitea URLGITEA_TOKEN
– Gitea personal access tokenORG_MAPPING
– JSON string mapping Github organizations to Gitea organizations