Skip to main content

CLI tool to migrate GitHub repos, update global git config and remotes

Project description

🧭 GitHub Repo Migrator

repo_migrator is a cross-platform Python CLI tool that:

  • 🔍 Finds all Git repositories on your local machine
  • 🔁 Updates GitHub remotes with a new GitHub username
  • 👤 Updates your global Git config (user.name, user.email)
  • 🚫 Supports excluding specific repositories
  • 📄 Lists all repositories in your home directory
  • 🐳 Includes Docker support and GitHub Actions workflows

Docker Image Build Docker Publish to GHCR Publish to PyPI Pylint


🚀 Features

  • Compatible with macOS, Linux, and Windows
  • Works with both HTTPS and SSH GitHub remotes
  • Supports --dry-run mode for safe previews
  • Cleanly structured and ready for CI/CD pipelines
  • Includes pre-commit hooks, linting, formatting, and tests

📦 Installation

Option 1: With pip (editable mode for local dev)

git clone https://github.com/Richard-Barrett/repo_migrator.git
cd repo_migrator
python3 -m venv venv
source venv/bin/activate
pip install -e .

The package is also published to pypi, and you can use pip to download it and install it

pip install github-repo-migrator

Option 2: Install via Docker (prebuilt image)

docker run --rm -v $HOME:$HOME ghcr.io/richard-barrett/repo-migrator:latest --list-repositories

🧪 CLI Usage

List all GitHub repositories in your home directory

repo-migrator --list-repositories

Update global Git config + GitHub remotes

repo-migrator \
  --new-github-username your-username \
  --new-email you@example.com

Simulate the changes (dry run)

repo-migrator \
  --new-github-username your-username \
  --new-email you@example.com \
  --dry-run

Exclude specific repositories by name

repo-migrator \
  --new-github-username your-username \
  --new-email you@example.com \
  --exclude-repositories repo1,repo2

🧰 Developer Guide

Run Tests

make test

Format with Black

make format

Run Pylint

make lint

Install Pre-commit Hooks

make hooks

🐳 Docker Build & Publish

To build the Docker image locally:

docker build -t repo-migrator .

To push to GitHub Container Registry (GHCR):

docker tag repo-migrator ghcr.io/richard-barrett/repo-migrator:latest
docker push ghcr.io/richard-barrett/repo-migrator:latest

A GitHub Actions workflow will automatically build and publish the image on push to main.


🔧 GitHub Actions Workflows Included

  • python.yml for testing, linting, and formatting
  • docker-publish.yml to build & push Docker images to GHCR
  • tag-release.yml to auto-bump versions with Git tags

🧼 Pre-commit Hooks

Install and run:

pre-commit install
pre-commit run --all-files

Hooks included:

  • black
  • pylint
  • check-yaml
  • end-of-file-fixer
  • trailing-whitespace
  • pyupgrade

📝 License

MIT © Richard Barrett

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

github_repo_migrator-0.1.1.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

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

github_repo_migrator-0.1.1-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file github_repo_migrator-0.1.1.tar.gz.

File metadata

  • Download URL: github_repo_migrator-0.1.1.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for github_repo_migrator-0.1.1.tar.gz
Algorithm Hash digest
SHA256 006dbcb02346fdea6482a5387a818d6f631c104941ad21e369c5a2a2f68f2257
MD5 4a40849851244460df05489dce6f5004
BLAKE2b-256 22e62c23c49886d3f77307b1502b5f9d22deee3720d3268fe78c89dc0b7a0d15

See more details on using hashes here.

File details

Details for the file github_repo_migrator-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for github_repo_migrator-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c468bec60857fa3f10b529b2790ffb03f23edde831e618f08eb85b557d2ccd27
MD5 11e7b7ff4b5f08edf9bdaf7112d87b49
BLAKE2b-256 c6fe3a5ef3cf1fe9c052f356f78370292b065c035ba8c91448fa0c2e7911c688

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