Repository navigation
v1.0.0
GitSync v1.0.0
GitSync is a Python script that mirrors all your GitHub repositories to GitLab, so you always have an off-platform backup. Run it manually, as a cron job, or from CI/CD.
Features
- Mirrors every GitHub repository to GitLab with full commit history
- Supports both personal and group namespaces on GitLab (
GITLAB_GROUP) - Configurable visibility for mirrored repos via
REPO_VISIBILITY:public,private, orauto(matches each repo's original GitHub visibility) - Rich terminal UI with live progress and logging
- Timestamped session logs saved in
Logs/ - Built-in automation:
build.shsets up the environment anddeploy.shschedules a cron job (with output logged toshell_logs.txt) - Dependencies managed with
uvand a pinneduv.lock - Works on macOS and Linux
Requirements
- Python 3.12+
- uv
- GitHub token with repo read access
- GitLab token with
apiandwrite_repositoryscopes
Quick start
git clone https://github.com/scienmanas/GitSync.git
cd GitSync
uv sync
# create .env (see .env.example)
uv run python main.pyTo schedule automated backups:
chmod +x build.sh deploy.sh
bash build.sh
bash deploy.sh # prompts for a cron schedule, e.g. 0 2 * * *Configuration
| Variable | Required | Description |
|---|---|---|
GITHUB_USER |
Yes | GitHub username |
GITHUB_TOKEN |
Yes | GitHub token (repo read access) |
GITLAB_USER |
Yes | GitLab username |
GITLAB_TOKEN |
Yes | GitLab token (api, write_repository) |
GITLAB_GROUP |
No | GitLab group namespace |
REPO_VISIBILITY |
No | public, private, or auto |
Known limitations
- Windows is untested; testing and bug reports are welcome
- GitLab's contribution graph may look different from GitHub's, but commit history is preserved
- A full run typically takes 15-20 minutes depending on repo count and size
License
MIT