GitLab to GitHub Auto Update is a Python tool that automates the import and mirroring of all your GitLab projects into GitHub. It handles bulk operations, auto-creates missing repos, and invokes GitHub’s Import API to keep both platforms in sync.
requests
library (pip install requests
)api
scoperepo
scopegit clone https://gitlab.com/bocaletto-luca/gitlab-to-github-auto.git
cd gitlab-to-github-auto
python3 -m venv venv
source venv/bin/activate
pip install requests
Open gitlab_to_github_auto_update.py
and set your credentials:
# GitLab settings
GITLAB_URL = "https://gitlab.com/api/v4"
GITLAB_TOKEN = "your_gitlab_token_here"
GITLAB_USERNAME = "bocaletto-luca"
# GitHub settings
GITHUB_API_URL = "https://api.github.com"
GITHUB_TOKEN = "your_github_token_here"
GITHUB_USERNAME = "bocaletto-luca"
Note: Never commit your tokens in plaintext. Use environment variables or a .env
file excluded from version control.
Run the script to start syncing:
chmod +x gitlab_to_github_auto_update.py
./gitlab_to_github_auto_update.py
Or simply:
python3 gitlab_to_github_auto_update.py
You will see console output showing which repos were created or already existed, and the status of each import trigger.
/projects?membership=true
endpoint, handling pagination.GET /repos/{user}/{repo}
and POST /user/repos
if missing.PUT /repos/{user}/{repo}/import
on GitHub, passing vcs_url
and credentials for private repos.Contributions, bug reports and feature requests are welcome! Please:
This project is released under the MIT License. See LICENSE
for details.