RepoSync is a powerful command-line tool written in Go
for securely cloning all repositories from a GitLab group or GitHub organization, including nested subgroups (GitLab) with zero-touch authentication configuration.
- Secure token storage - Credentials saved in user home directory
- Clone all repositories from GitLab groups (with subgroups) or GitHub organizations
- HTTPS/SSH cloning support
- Automatic directory structure mirroring
- Configuration wizard for easy setup
- Skipping of existing cloned repositories
my-group/ # Parent group
├── backend/ # Subgroup
│ ├── auth-service/ # Repository
│ └── payment-service/
├── frontend/
│ ├── web-app/
│ └── mobile-app/
└── tools/ # Root group repositories
├── ci-cd-templates/
└── monitoring-system/
-
📁 Groups/Subgroups mirror GitLab's hierarchy
-
📂 Repositories cloned as individual directories
-
🔄 Existing directories are automatically skipped
-
🔐 SSH/HTTPS only affects clone URLs, not structure
my-org/ # Organization root
├── docs-website/ # Repository
├── api-gateway/
├── user-management/
└── infrastructure-as-code/
This structure matches your GitLab/GitHub organization layout exactly, making it ideal for:
my-group/
└── frontend/
└── web-app/ # Matches GitLab's "my-group > frontend > web-app"
-
Instant Context: Paths are identical to GitLab/GitHub web interface
-
Multi-Repo Workflows:
# Work on related repos simultaneously
cd my-group/frontend/web-app && npm run dev
cd ../shared-components && npm link ../web-app
backup-2024/
├── my-group/ # Full hierarchy preserved
│ └── infrastructure/
└── my-org/ # GitHub repos in flat structure
-
Disaster Recovery: Restore exact group/repo relationships
-
Version Snapshots: Combine with
git bundle
for offline backups -
Audit Compliance: Maintain organizational structure for compliance checks
ci-scripts/
├── deploy-frontend.sh # Relies on consistent paths:
│ # "my-group/frontend/web-app"
└── security-scan.sh # Scans all "my-group/backend/*" repos
- Path-Based Automation:
# Scan all backend services
for repo in my-group/backend/*; do
trivy config "$repo"
done
- Docker/K8s Integration:
COPY ./my-group/backend/auth-service /app # Predictable source paths
.code-workspace (VS Code)
{
"folders": [
{"path": "my-group/frontend/web-app"},
{"path": "my-group/backend/auth-service"}
]
}
-
Persistent Contexts: Workspace files remain valid across re-clones
-
Cross-Repo Navigation:
-
- JetBrains IDEs:
Ctrl+Click
between../shared-components
and../web-app
.
- JetBrains IDEs:
-
- VS Code Multi-Root: Edit related repos in single window
- Git (Download Git)
- Go 1.20+ (Download Go)
go install github.com/itszeeshan/reposync@latest
Move the binary to /usr/local/bin
so it can be used system-wide:
sudo mv $(go env GOPATH)/bin/reposync /usr/local/bin/
Now you can run reposync
from anywhere. 🚀
- Configure your credentials (first-time setup):
reposync config
Follow the prompts to enter your GitLab and GitHub personal access tokens
- Verify configuration:
cat ~/.reposync/config.json
# Basic syntax
reposync -p <gitlab|github> -g <GROUP_ID|ORG_NAME> [-m <https|ssh>]
# Examples
reposync -p gitlab -g 123456 # Clone GitLab group with HTTPS
reposync -p github -g your-org -m ssh # Clone GitHub org with SSH
Argument | Description |
---|---|
-p |
Provider: gitlab or github (required) |
-g |
Group ID (GitLab) or Organization ID (GitHub) |
-m |
Clone method: https (default) or ssh |
reposync -p github -g your-org
reposync -p gitlab -t glpat_yourtoken -g 123456 -m ssh
# If receiving permission errors:
reposync config # Update stored credentials
-
Rotate tokens: Re-run
reposync config
-
Delete credentials: rm
~/.reposync/config.json
- Ensure
git
is installed:git --version
- Ensure you have network access to GitHub/GitLab.
- Ensure tokens have required scopes:
-
GitHub:
repo
scope -
GitLab:
read_api
scope
- SSH cloning requires:
-
SSH key added to your account
-
ssh-agent
running
Pull requests are welcome! If you encounter issues, feel free to open an issue on GitHub.
MIT License. See LICENSE
for details.