Skip to content

A utility to batch transfer GitHub repositories from one organization or user to another.

License

Notifications You must be signed in to change notification settings

nicklegan/github-repo-transfer-utility

Repository files navigation

GitHub Repository Transfer Utility

A utility to batch transfer GitHub repositories from one organization or user to another.

Transfer repositories using an interactive wizard or manually edit a generated CSV file, including the ability to assign existing teams.

demo

Usage

Set Codespaces or .env secrets

Set a Personal Access Token either as a Codespaces secret or in a .env file when running locally.

Name Value Required
TOKEN A repo, read:org scoped Personal Access Token true

💡 Make sure you're an org owner for both source and destination organizations.

💡 Your personal user account will show up first in the list of available organizations.

💡 As every repository transfer sends an email to the repository owner you may want to use a machine user with separate email instead to avoid a full mailbox.

Deployment

Choose between running in a Codespace, Docker or Node.

Codespaces

  1. Fork or clone the repository
  2. Set your Personal Access Token as a Codespaces secret
  3. Create a codespace for your repository

Docker

cp .env.example .env
npm install

# terminal 1
docker build -t repo-transfer-utility .
docker run -it repo-transfer-utility npm start

# terminal 2
docker container ls
docker exec -it <container-id> /bin/sh

vi repos.csv # (edit generated CSV when using manual mode)

Node

cp .env.example .env

npm install
npm start

Flowchart

graph TD;
    A(Begin the transfer process by retrieving the available organizations)-->|start/abort|B
    B(Select a source organization to transfer repositories from)-->|list select|C
    C(Select a destination organization to transfer repositories to)-->|list select|D
    D(Choose your transfer method)
    D-->|use the interactive transfer wizard|F
    F(Select repositories to transfer)-->|checkbox select|G
    D-->|manually edit a generated CSV file|G
    G(Select the destination org teams you want to assign to the repos)-->|checkbox select|H
    H(Press confirm to continue or abort to quit)-->|confirm/abort|I
    I(Are you really sure you want to transfer X repositories from Org X to Org Y?)-->|confirm/abort|J
    H-->|confirm/abort|K
    K(CSV file is generated, edit the CSV and press confirm when done)-->|confirm/abort|L
    L(Are you really sure you want to transfer X repositories?)-->|confirm/abort|J
    J(Transfer repositories)

CSV Layout (manual mode)

repo,source org,destination org,[team ids]

About

A utility to batch transfer GitHub repositories from one organization or user to another.

Resources

License

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages