Skip to main content

No project description provided

Project description

๐Ÿ”„ gh2gl

โœจ GitHub to GitLab Mirroring CLI โœจ

Seamlessly mirror your GitHub repositories to GitLab with style and ease

Python Rich CLI


๐ŸŒŸ Features

  • ๐Ÿ” Secure Authentication - Store GitHub & GitLab tokens safely with keyring
  • ๐Ÿš€ Bulk Mirroring - Mirror all your repositories at once
  • ๐ŸŽจ Beautiful UI - Rich terminal interface with progress bars and panels
  • ๐Ÿ”’ Private Repos - Full support for private repositories
  • โšก Smart Sync - Skip existing repos or force overwrite with --force
  • ๐Ÿงน Clean Names - Automatic project name sanitization for GitLab compatibility
  • ๐Ÿ“Š Progress Tracking - Real-time statistics and detailed reporting
  • ๐Ÿƒ Dry Run - Preview operations without making changes
  • ๐Ÿ› ๏ธ Self-Hosted - Works with custom GitLab instances

๐Ÿ“ฆ Installation

For Users

# Install with pipx (recommended)
pipx install gh2gl

# Or install with pip
pip install gh2gl

For Development

# Clone the repository
git clone https://github.com/viniciusccosta/gh2gl.git
cd gh2gl

# Install in development mode
pip install -e .

๐Ÿš€ Quick Start

1๏ธโƒฃ Setup Authentication

# Login to GitHub
gh2gl login github

# Login to GitLab
gh2gl login gitlab

2๏ธโƒฃ Test Connections

# Verify API connectivity
gh2gl test

3๏ธโƒฃ Mirror Repositories

# Preview what will be mirrored (dry run)
gh2gl mirror --dry-run

# Mirror all repositories
gh2gl mirror

# Force sync existing repositories
gh2gl mirror --force

๐Ÿ“‹ Commands

Command Description Example
status ๐Ÿ“Š Check credential configuration gh2gl status
test ๐Ÿงช Test API connectivity gh2gl test
login github ๐Ÿ”‘ Setup GitHub authentication gh2gl login github
login gitlab ๐Ÿ”‘ Setup GitLab authentication gh2gl login gitlab
mirror ๐Ÿ”„ Mirror repositories gh2gl mirror

โš™๏ธ Command Options

Mirror Command Flags

  • --dry-run ๐Ÿ‘€ - Preview operations without making changes
  • --skip-existing โญ๏ธ - Skip repositories that already exist on GitLab
  • --force ๐Ÿ’ช - Overwrite existing GitLab repositories
# Examples
gh2gl mirror --dry-run          # Preview only
gh2gl mirror --skip-existing    # Skip existing repos
gh2gl mirror --force            # Force overwrite all

๐Ÿ”ง Configuration

GitHub Token Setup

  1. Go to GitHub Settings โ†’ Developer settings โ†’ Personal access tokens
  2. Create a token with repo and user permissions
  3. Run gh2gl login github and enter your token

GitLab Token Setup

  1. Go to GitLab User Settings โ†’ Access Tokens
  2. Create a token with api, read_repository, and write_repository scopes
  3. Run gh2gl login gitlab and enter your details

Custom GitLab Instance

# For self-hosted GitLab
gh2gl login gitlab
# Enter your custom GitLab URL when prompted

๐Ÿ“ธ Screenshots

Beautiful Status Display

โ”Œโ”€ Credential Status โ”€โ”
โ”‚ โœจ All credentials  โ”‚
โ”‚ configured!         โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Rich Progress Tracking

๐Ÿ”„ Mirroring GitHub โ†’ GitLab
โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 100% 23/23 repos

โ”Œโ”€ Summary โ”€โ”
โ”‚ โœ… 21 Created    โ”‚
โ”‚ โญ๏ธ  2 Skipped    โ”‚
โ”‚ โŒ 0 Errors      โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ—๏ธ How It Works

  1. ๐Ÿ” Discovery - Fetches all your GitHub repositories (public + private)
  2. ๐Ÿงน Sanitization - Cleans repository names for GitLab compatibility
  3. ๐Ÿ”„ Mirroring - Uses git clone --mirror for complete repository copies
  4. ๐Ÿ“ค Upload - Pushes to GitLab with proper authentication
  5. ๐Ÿ“Š Reporting - Provides detailed success/error statistics

๐Ÿ›ก๏ธ Security

  • ๐Ÿ” Secure Storage - Tokens stored safely using system keyring
  • ๐Ÿšซ No Plaintext - Credentials never stored in configuration files
  • ๐Ÿ”’ OAuth2 - Uses secure OAuth2 authentication for GitLab
  • ๐Ÿ‘ค User Scoped - Only accesses repositories you have permission to

๐Ÿ› Troubleshooting

Common Issues

404 Errors

  • Ensure your tokens have the correct permissions
  • Verify GitLab URL is correct for self-hosted instances

Authentication Failed

  • Re-run the login commands to refresh tokens
  • Check token expiration dates

Repository Name Conflicts

  • The tool automatically sanitizes names for GitLab compatibility
  • Use --force to overwrite existing repositories

Debug Mode

# Run with verbose output
gh2gl mirror --dry-run  # See what would happen first

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


Made with โค๏ธ and โ˜•

Happy mirroring! ๐Ÿš€

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gh2gl-0.1.0.tar.gz (11.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gh2gl-0.1.0-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

Details for the file gh2gl-0.1.0.tar.gz.

File metadata

  • Download URL: gh2gl-0.1.0.tar.gz
  • Upload date:
  • Size: 11.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.13.7 Darwin/24.6.0

File hashes

Hashes for gh2gl-0.1.0.tar.gz
Algorithm Hash digest
SHA256 70de219b54c229b73e39bee7ae940ddd9cc24b75389e1a9829979414c9e71a1d
MD5 7b931f8c937391b02c79684dfc86158b
BLAKE2b-256 4ba3c5dce451668e3c4f72dd22bd247b2f91462eb1391d6e0ec49fe0b8995e89

See more details on using hashes here.

File details

Details for the file gh2gl-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: gh2gl-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.13.7 Darwin/24.6.0

File hashes

Hashes for gh2gl-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4d6e02631f69397594e595a5fb65b318cf3c1617f26945a4de96fecf74ff2552
MD5 273ba61004ab9a17e2c87903e5aaac10
BLAKE2b-256 916d3ded1cb890b6b9690aef0a50f18f94faec8f9b6732aff9f585ab66736a62

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page