Hub2Lab is a tool to manage and sync your GitHub repositories. It can sync them to GitLab (creating missing ones) or download them all locally.
Create a .env file in the root directory:
GITHUB_TOKEN=your_github_token
GITLAB_TOKEN=your_gitlab_tokenGITHUB_TOKENis required for all commands. Needs to have read-only access to your repositories.GITLAB_TOKENis required forsync. Needs to have read-write access to your repositories.
Run the tool using Odin:
odin run src/main.odin -file -- [command] [options]sync(default): Syncs repositories from GitHub to GitLab.- Checks existence and creates missing repos on GitLab (Serial, Optimized O(N)).
- Ensures local repo is up to date (Clone or Pull).
- Pushes content to GitLab (Parallel).
download: Downloads all repositories locally (Clone or Pull).
--dry-run: Prints what would happen without performing any write actions (create, clone, push, update).--threads N,-j N: Number of threads to use for parallel operations (default: 8).--output-dir DIR,-o DIR: Directory to download/sync repositories to (default:downloaded_repos). Applies to bothsyncanddownload.
Sync all repos with 8 threads:
odin run src/main.odin -file -- sync --threads 8Sync/Download all repos to a specific folder:
odin run src/main.odin -file -- sync -o ~/my_backups/githubDry run check:
odin run src/main.odin -file -- sync --dry-run