Skip to content

itchyny/github-migrator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

github-migrator

This tool migrates a GitHub repository to another. This is especially useful to move a repository from GitHub Enterprise to github.com.

Usage

export GITHUB_MIGRATOR_SOURCE_API_TOKEN=xxx
export GITHUB_MIGRATOR_SOURCE_API_ENDPOINT=http://localhost/api/v3 # This might be the endpoint of GitHub Enterprise
export GITHUB_MIGRATOR_TARGET_API_TOKEN=yyy
# export GITHUB_MIGRATOR_TARGET_API_ENDPOINT=https://api.github.com # No need to specify the endpoint of github.com
# export GITHUB_MIGRATOR_TARGET_PROXY_URL=http://proxyIp:proxyPort # If you need proxy URL
go run . [old-owner]/[source] [new-owner]/[target]

Be sure to use this tool before pushing the git tree to the new origin (otherwise the links in the merged commits are lost).

Other options

Sometimes same user has different user id on GitHub and Enterprise.

export GITHUB_MIGRATOR_USER_MAPPING=user-before1:user-after1,user-before2:user-after2,user-before3:user-after3

Requirements

  • Go 1.17+
  • API tokens to access the source and target repositories.

Features

  • Issues
    • Issue description with the link to the original repository
    • Issue comments with the user name and icon (within the comment)
    • Created dates, Labels
    • Issue numbers are same as the original repository
    • Various events (including title changes, issue locking, assignments, review requests and branch deletion in a pull request)
  • Pull requests
    • A pull request is converted to an issue
    • Comments and review comments are migrated as issue comments
    • Created dates, Labels
    • Pull request numbers (issue numbers) are same as the original repository
    • Number of changed files, insertions and deletions
    • Entire diff (excluding large file diffs)
    • Commits list and link to the corresponding /compare/ page
  • Repository information
    • Description, Homepage (only when the target repository has blank description, homepage)
  • Labels
    • Label name, description and colors
    • Label changes in issue and pull request
  • Projects
    • Projects, columns and cards
    • Note that column automations are not migrated (cannot be set via API)
  • Milestones
    • Milestone titles, description and due date
    • Connect issues to milestones
  • Webhooks
    • Webhook URL, content type and events the hooks is trigger for.
  • All the other things will be lost
    • Images posted to issue and pull request comments.
    • Emoji reactions to issue and pull request comments
    • Diffs (split) view of pull requests
    • Wiki
    • Default branch, Protection rules
    • Notifications, Integrations

Bug Tracker

Report bug at Issues・itchyny/github-migrator - GitHub.

Author

itchyny (https://github.com/itchyny)

License

This software is released under the MIT License, see LICENSE.

Previous works and references

About

GitHub repository migrator

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published

Contributors 3

  •  
  •  
  •