RepoMigrate

Released

RepoMigrate is a powerful Go-based tool for effortless Git repository migration with complete history preservation. It preserves all commits, authors, branches, tags, and references, making it ideal for migrating repositories between GitHub, GitLab, and other Git hosting services.

Features

  • Complete history preservation (commits, branches, tags, references)
  • Multiple authentication methods (token-based and SSH key)
  • GitHub CLI integration for automatic authentication
  • Flexible configuration with global and repository-specific auth settings
  • Secure by default with enforced file permissions
  • Detailed logging with multiple output formats
  • Cross-platform support (macOS, Linux, Windows)

Why RepoMigrate?

Couldn’t I just use git??

You absolutely could. Here’s an example:

$ git clone --mirror <source> . && git remote set-url --push origin <destination>

This works perfectly fine for the occasional repository move. If you’re a Git expert who only needs to migrate a single repo, that one-liner might be all you need.

But RepoMigrate really shines when:

  • Migrating multiple repositories at once
  • Working across different authentication methods
  • Needing a repeatable, documented process
  • Handling migrations as part of larger projects

RepoMigrate transforms ad-hoc Git commands into a structured process through YAML configuration, proper error handling, and secure credential management.

Example Configuration

Cross-Platform Migration

# Repository Migration Configuration
repositories:
  - source: "https://github.com/user/source-repo.git"
    destination: "https://github.com/organization/destination-repo.git"
  
  # Example with different tokens for source and destination
  - source: "https://github.com/user/repo2.git"
    destination: "https://gitlab.com/new-org/repo2.git"
    # Source-specific authentication
    source_auth:
      token: "github-specific-token"
    # Destination-specific authentication
    destination_auth:
      token: "gitlab-specific-token"

# Global authentication configuration
auth:
  # For token authentication 
  token: "your-token" 
  
  # For SSH key authentication
  # ssh_key: "~/.ssh/id_rsa"
  # ssh_user: "git"

Security Considerations

  • Configuration files have 0600 permissions (readable only by owner)
  • SSH key files require 0600 permissions
  • Environment variables can be used to avoid storing tokens in configuration files
  • Repository-specific authentication overrides are supported

The source code is available on GitHub under the MIT license.