Skip to content

Bash script to help you copy/migrate all the repos (including branches/tags) from one GitHub organisation to another

License

Notifications You must be signed in to change notification settings

edgranau/githoover

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

GitHoover

Bash script to help you copy/migrate all the repos (inc branches/tags) from one GH org to another

Description

This script will attempt to:

  • create a new directory with SOURCE_ORG name and cd into it
  • clone all the repos (including branches/tags) from SOURCE_ORG
  • for each non empty repo:
    • update the name of the repo if it doesn't start with PREFIX
    • create an empty repo in TARGET_ORG with the updated name and grants TEAM_NAME access to it
    • update the local repo's remote origin to point to new repo in TARGET_ORG
    • push all branches/tags from local repo to new remote

Assumptions

  • Your github account is a member of both SOURCE_ORG and TARGET_ORG
  • Migrated repos' names will be PREFIX-ORIGINAL_NAME
  • TEAM_NAME exists in TARGET_ORG

Dependencies

This script uses jq under the hood to parse response json payloads

You need to have access to both repositories and create an access token for your account. This token needs to have :

  • repo: Grants read/write access to code, commit statuses, invitations, collaborators, adding team memberships, and deployment statuses for public and private repositories and organizations
  • read:org: Read-only access to organization, teams, and membership

See github documentation here

Usage

bash githoover.sh

Note

If your repos have pull requests made to them, you will see errors like this:

! [remote rejected] refs/pull/1/head -> refs/pull/1/head (deny updating a hidden ref)

See this for more information.

References

About

Bash script to help you copy/migrate all the repos (including branches/tags) from one GitHub organisation to another

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages