Hey there! 👋 Welcome to our migration tools repository – your go-to toolkit for seamlessly transferring repos and metadata from GitHub Enterprise Server, Bitbucket, and more to GitHub Enterprise Cloud. 🌐✨ Whether you're switching platforms or consolidating your projects, our collection of utilities is here to make your migration journey smooth and stress-free.
- Clone the repo: git clone https://github.com/ModusCreateOrg/gh-migration-scripts.git
- Navigate to the tools directory:
cd gh-migration-scripts
- Run
npm install -g
- Follow our detailed documentation for step-by-step instructions on using each tool.
Features | GHEC |
---|---|
1. Import repository direct collaborators | ✅ import-github-repo-collaborators |
2. Import repository team permissions | ✅ import-github-repo-team-permission |
3. Import teams | ✅ import-github-teams |
4. Import team members | ✅ import-github-team-members |
5. Archive/unarchive repositories | ✅ set-github-archived-status |
6. Delete repositories | ✅ delete-github-repos |
7. Import organization memberships | ✅ import-github-membership-in-org |
8. Import organization projects | ✅ import-github-projects-v2 |
9. Import repository on gh from bb | ✅ import-github-repo-from-bitbucket |
Exports all repositories of a github organization
git-migrator export-github-repos
-o
or--organization
- Organization name.-a
or--allow-untrusted-ssl-certificates
- Allow connections to a GitHub API endpoint that presents a SSL certificate that isn't issued by a trusted CA.-b
or--batch-size
- Batch size for GraphQL request.-g
or--server-url
- The target GHES server endpoint url. If this argument is skipped then the target will be the cloud instance.-y
or--output-file
- Output file to save the operation results. The default format is discussed below. Default file name is<organization>-metrics/<organization>-repo-metrics-<date>-<target>.csv
. date - Format is DD/MM/YYYY - The date is when the file is created target - ghes or ghec-t
or--token
- Personal access token.-s
or--skip
- Number of lines to skip in the input file. Default is set to 0.-u
or--users-file
- File with user names so only those users will be considered. Should have the column namelogin
.-w
or--wait-time
- Delay time (in seconds) to wait between requests. Default value is 1 second.
No input is required.
Repo team permissions will be exported in the first step.
Exports the direct collaborators of repositories in a github organization.
git-migrator export-github-repo-direct-collaborators
-f
or--input-file
- Input file with repository names.-o
or--organization
- Organization name.c
or--outside-collaborators-file
- Outside collaborators files to filter out the result. The api for repository directory collaborators returns outside collaborators as well. The CSV file should have a column with the namelogin
.-g
or--server-url
- The target GHES server endpoint url. If this argument is skipped then the target will the cloud instance.-y
or--output-file
- Output file to save the operation results. If not provided, the default file the results saved is<organization>-repo-direct-collaborators-<timestamp>.csv
.-t
or--token
- Personal access token.-s
or--skip
- Number of lines to skip in the input file. Default is set to 0.-u
or--users-file
- File with user names so only those users will be considered. Should have the column namelogin
.-w
or--wait-time
- Delay time (in seconds) to wait between requests. Default value is 1 second.
repo |
---|
abc-repo |
Repositories direct collaborators role file (-y | --output-file)
repo | login | role |
---|---|---|
test-repo | test-user | admin |
Status file
repo | status | statusText | errorMessage |
---|---|---|---|
test-repo | Success |
All the above 3 actions are done by the below export-github-teams-and-permissions
script.
Exports all teams of an organization along with team memberships and repo team permissions.
git-migrator export-github-teams-and-permissions
-o
or--organization
- Organization name.-a
or--allow-untrusted-ssl-certificates
- Allow connections to a GitHub API endpoint that presents a SSL certificate that isn't issued by a trusted CA.-b
or--batch-size
- Batch size for GraphQL request.-g
or--server-url
- The target GHES server endpoint url. If this argument is skipped then the target will be the cloud instance.-y
or--output-file
- Output file to save the operation results. The default format is discussed below. The default file name is applicable only for the team metrics file.-t
or--token
- Personal access token.-s
or--skip
- Number of lines to skip in the input file. Default is set to 0.-u
or--users-file
- File with user names so only those users will be considered. Should have the column namelogin
.-w
or--wait-time
- Delay time (in seconds) to wait between requests. Default value is 1 second.
No input is required.
Three files are created as part of this operation.
a. Teams metrics - Contains the teams info.
Format
name | id | slug | combinedSlug | description | privacy | url | repositories | repositoriesCount | childTeams | members | membersCount | parentTeam | parentTeamId | repositoriesUrl | repositoriesResourcePath | resourcePath | createdAt | updatedAt |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Sample Team | 123 | sample-team | org/sample-team | Desc | closed | https://url.com | repo-name:permission | 1 | null | abc:[email protected]:role | 1 | parent-team-slug | 2 | https://url.com | /orgs/org/teams/owners/repositories | /orgs/org/teams/owners | 2018-11-02T21:22:15Z | 2018-11-02T21:22:15Z |
Default file name is <organization>-metrics/<organization>-team-metrics-<date>-<target>.csv
.
date - Format is DD/MM/YYYY - The date is when the file is created
target - ghes or ghec
b. Team members - File with members' roles of each team.
Format
member | team | role |
---|---|---|
abc-user | sample-team | maintainer |
Default file name is <organization>-metrics/<organization>-member-team-role-<date>-<target>.csv
.
date - Format is DD/MM/YYYY - The date is when the file is created
target - ghes or ghec
If a custom output file name is given, the team members file name will be <custom-output-file>-member-team-role-<date>-<target>.csv
c. Team repositories - File with repository permissions of each team.
Format
repo | team | permission |
---|---|---|
sample-repo | sample-team | write |
Default file name is <organization>-metrics/<organization>-repo-team-permission-<date>-<target>.csv
.
date - Format is DD/MM/YYYY - The date is when the file is created
target - ghes or ghec
If a custom output file name is given, the team repos file name will be <custom-output-file>-repo-team-permission-<date>-<target>.csv
.
Exports all users from all github organizations on the enterprise server.
git-migrator export-github-enterprise-users
-a
or--allow-untrusted-ssl-certificates
- Allow connections to a GitHub API endpoint that presents a SSL certificate that isn't issued by a trusted CA.-b
or--batch-size
- Batch size for GraphQL request.-e
or--enterprise-organizations
- List of organizations on the enterprise. Organization names should be given space separated. E.g-e org1 org2 org3
.-g
or--server-url
- The target GHES server endpoint url. If this argument is skipped then the target will the cloud instance.-y
or--output-file
- Output file to save the operation results. If not provided, the default file the results saved isenterprise-users-<timestamp>.csv
.-t
or--token
- Personal access token.-u
or--users-file
- File with user names so only those users will be considered. Should have the column namelogin
.-w
or--wait-time
- Delay time (in seconds) to wait between requests. Default value is 1 second.
No input file is required
login |
---|
user1 |
user2 |
Exports users details in an organization.
git-migrator export-github-org-users
-o
or--organization
- Organization name.-a
or--allow-untrusted-ssl-certificates
- Allow connections to a GitHub API endpoint that presents a SSL certificate that isn't issued by a trusted CA.-b
or--batch-size
- Batch size for GraphQL request.-g
or--server-url
- The target GHES server endpoint url. If this argument is skipped then the target will the cloud instance.-y
or--output-file
- Output file to save the operation results. If not provided, the default file the results saved is<organization>-metrics/<organization>-user-metrics-13-11-2023-ghes.csv
. If the target is GHEC, then the end part of the file will be 'ghec' instead of 'ghes'. Moreover, the date part in the output file isDD/MM/YYYY
.-t
or--token
- Personal access token.-u
or--users-file
- File with user names so only those users will be considered. Should have the column namelogin
.-w
or--wait-time
- Delay time (in seconds) to wait between requests. Default value is 1 second.
No input file is required
login | name | role | hasTwoFactorEnabled | id | avatarUrl | url | websiteUrl | isSiteAdmin | isViewer | projectsUrl | projectsResourcePath | createdAt | updatedAt | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
sample-login | Sample Login | sample-login@email | admin | true | 123 | https://avatar-url.com | https://url.com | https://website-url.com | false | false | https://projects-url.com | /orgs/org/teams/owners/projects | 2018-11-02T21:22:15Z | 2018-11-02T21:22:15Z |
Exports all V1 projects of a github organization.
git-migrator export-github-projects-v1
-o
or--organization
- Organization name.-a
or--allow-untrusted-ssl-certificates
- Allow connections to a GitHub API endpoint that presents a SSL certificate that isn't issued by a trusted CA.-b
or--batch-size
- Batch size for GraphQL request.-g
or--server-url
- The target GHES server endpoint url. If this argument is skipped then the target will the cloud instance.-y
or--output-file
- Output file to save the operation results. If not provided, the default file the results saved is<organization>-metrics/<organization>-projects-v2-ghes-<date-time>.csv
. If the target is GHEC, then the end part of the file will be 'ghec' instead of 'ghes'.-t
or--token
- Personal access token.-w
or--wait-time
- Delay time (in seconds) to wait between requests. Default value is 1 second.
No input file is required
Output is a JSON file with projects info.
Exports all V2 projects of a igthub organization.
git-migrator export-github-projects-v2
-o
or--organization
- Organization name.-a
or--allow-untrusted-ssl-certificates
- Allow connections to a GitHub API endpoint that presents a SSL certificate that isn't issued by a trusted CA.-b
or--batch-size
- Batch size for GraphQL request.-g
or--server-url
- The target GHES server endpoint url. If this argument is skipped then the target will the cloud instance.-y
or--output-file
- Output file to save the operation results. If not provided, the default file the results saved is<organization>-metrics/<organization>-projects-v2-ghes-<date-time>.csv
. If the target is GHEC, then the end part of the file will be 'ghec' instead of 'ghes'.-t
or--token
- Personal access token.-w
or--wait-time
- Delay time (in seconds) to wait between requests. Default value is 1 second.
No input file is required
Output is a JSON file with projects info.
Creates V2 projects in an organization.
git-migrator import-github-projects-v2
-o
or--organization
- Organization name.-f
or--input-file
- Input file with projects v2 info.-a
or--allow-untrusted-ssl-certificates
- Allow connections to a GitHub API endpoint that presents a SSL certificate that isn't issued by a trusted CA.-b
or--batch-size
- Batch size for GraphQL request.-g
or--server-url
- The target GHES server endpoint url. If this argument is skipped then the target will the cloud instance.-y
or--output-file
- Output file to save the operation results. If not provided, the default file the results saved is<organization>-metrics/<organization>-create-projects-v2-ghes-<date-time>.csv
. If the target is GHEC, then the end part of the file will be 'ghec' instead of 'ghes'.-t
or--token
- Personal access token.-w
or--wait-time
- Delay time (in seconds) to wait between requests. Default value is 1 second.
No input file is required
Output is a JSON file with projects info.
Imports repositories on GitHub from Bitbucket.
git-migrator import-github-repo-from-bitbucket
-f
or--input-file
- Input file name with repo, team & permission info.-o
or--organization
- Organization name.-g
or--server-url
- The target GHES server endpoint url. If this argument is skipped then the target will the cloud instance.-y
or--output-file
- Output file to save the operation results. If not provided, the default file the results saved is<organization>-set-repo-team-permission-status-<timestamp>.csv
. This output file logs the successful teams permissions added to repositories.-t
or--token
- Personal access token.-r
or--repos-file
- File with repos names so only those repos will be considered. Should have the columnrepos
.-s
or--skip
- Number of lines to skip in the input file. Default is set to 0.-w
or--wait-time
- Delay time (in seconds) to wait between requests. Default value is 1 second.
git-migrator import-github-repo-from-bitbucket -f user-bitbucket-repo-9:19:2024-8:31:59-AM.csv
Note: Input the .csv file generated in the previous
git-migrator export-bitbucket-repos -o org --server-url https://api.bitbucket.org/2.0
command.
Exports team permissions of all repositories of a bitbucket project.
git-migrator export-bitbucket-repo-team-permissions
-o
or--organization
- Organization name.-f
or--input-file
- Input file name with repo name.-b
or--batch-size
- Batch size for requests.-g
or--server-url
- The bitbucket server URL.-y
or--output-file
- Output file to save the operation results. If not provided, the default file the results saved is<organization>-bitbucket-repo-teams-permissions-<date-time>.csv
.-t
or--token
- Personal access token.-w
or--wait-time
- Delay time (in seconds) to wait between requests. Default value is 1 second.
repo |
---|
sample-repo |
repo | team | permission |
---|---|---|
sample-repo | sample-team | write |
Exports all repositories of a bitbucket organization (workspace).
git-migrator export-bitbucket-repos
-o
or--organization
- Organization name.-b
or--batch-size
- Batch size for requests.-g
or--server-url
- The bitbucket server URL.-y
or--output-file
- Output file to save the operation results. If not provided, the default file the results saved is<organization>-bitbucket-repo-<date-time>.csv
.-t
or--token
- Personal access token.-w
or--wait-time
- Delay time (in seconds) to wait between requests. Default value is 1 second.
No input is required
repo |
---|
sample-repo |
Exports users permissions of all repositories of a bitbucket organization (workspace).
git-migrator export-bitbucket-repo-direct-collaborators
-o
or--organization
- Organization name.-f
or--input-file
- Input file name with repo names.-b
or--batch-size
- Batch size for requests.-g
or--server-url
- The bitbucket server URL.-y
or--output-file
- Output file to save the operation results. If not provided, the default file the results saved is<organization>-bitbucket-repo-direct-collaborators-<date-time>.csv
.-t
or--token
- Personal access token.-w
or--wait-time
- Delay time (in seconds) to wait between requests. Default value is 1 second.
repo |
---|
sample-repo |
repo | login | role |
---|---|---|
sample-repo | test-user | write |
Exports all teams of a Bitbucket project.
git-migrator export-bitbucket-teams
-o
or--organization
- Organization name.-b
or--batch-size
- Batch size for requests.-g
or--server-url
- The bitbucket server URL.-y
or--output-file
- Output file to save the operation results. If not provided, the default file the results saved is<organization>-bitbucket-teams-<date-time>.csv
.-t
or--token
- Personal access token.-w
or--wait-time
- Delay time (in seconds) to wait between requests. Default value is 1 second.
No input is required.
name | slug | privacy | description | parentTeam |
---|---|---|---|---|
Sample Team | sample-team | closed | sample team desc | parent-team |
Exports team members of a bitbucket project.
git-migrator export-bitbucket-team-members
-o
or--organization
- Organization name.-f
or--input-file
- Input file name with team names.-b
or--batch-size
- Batch size for requests.-g
or--server-url
- The bitbucket server URL.-y
or--output-file
- Output file to save the operation results. If not provided, the default file the results saved is<organization>-bitbucket-team-members-<date-time>.csv
.-t
or--token
- Personal access token.-w
or--wait-time
- Delay time (in seconds) to wait between requests. Default value is 1 second.
team |
---|
team-1 |
member | team | role |
---|---|---|
test-user | team-1 | admin |
Exports users of a bitbucket project.
git-migrator export-bitbucket-project-users
-o
or--organization
- Organization name.-b
or--batch-size
- Batch size for requests.-g
or--server-url
- The bitbucket server URL.-y
or--output-file
- Output file to save the operation results. If not provided, the default file the results saved is<organization>-bitbucket-organization-users-<date-time>.csv
.-t
or--token
- Personal access token.-w
or--wait-time
- Delay time (in seconds) to wait between requests. Default value is 1 second.
No input is required
login |
---|
test-user |
Exports users of a bitbucket enterprise.
git-migrator export-bitbucket-enterprise-users
-o
or--organization
- Organization name.-b
or--batch-size
- Batch size for requests.-g
or--server-url
- The bitbucket server URL.-y
or--output-file
- Output file to save the operation results. If not provided, the default file the results saved is<organization>-bitbucket-enterprise-users-<date-time>.csv
.-t
or--token
- Personal access token.-w
or--wait-time
- Delay time (in seconds) to wait between requests. Default value is 1 second.
No input is required
login |
---|
test-user |
Exports all repositories of a Gitlab organization.
git-migrator export-gitlab-repositories
-o
or--organization
- Organization name.-f
or--input-file
- Input file name with repo name.-b
or--batch-size
- Batch size for requests.-g
or--server-url
- The gitlab server URL.-y
or--output-file
- Output file to save the operation results. If not provided, the default file the results saved is<organization>-gitlab-repos-<date-time>.csv
.-t
or--token
- Personal access token.-w
or--wait-time
- Delay time (in seconds) to wait between requests. Default value is 1 second.
No input is required
name | repo | group | id | isArchived | visibility |
---|---|---|---|---|---|
abc/repo-name | repo-name | sample-group | 123 | false | private |
Exports direct collaborators of all repositories of a Gitlab organization.
git-migrator export-gitlab-repo-direct-collaborators
-o
or--organization
- Organization name.-f
or--input-file
- Input file name with repo names.-b
or--batch-size
- Batch size for requests.-g
or--server-url
- The gitlab server URL.-y
or--output-file
- Output file to save the operation results. If not provided, the default file the results saved is<organization>-gitlab-repo-direct-collaborators-<date-time>.csv
.-t
or--token
- Personal access token.-w
or--wait-time
- Delay time (in seconds) to wait between requests. Default value is 1 second.
repo |
---|
sample-repo |
repo | login | role |
---|---|---|
sample-repo | test-user | write |
Exports all teams of a gitlab organization.
git-migrator export-gitlab-teams
-o
or--organization
- Organization name.-b
or--batch-size
- Batch size for requests.-g
or--server-url
- The gitlab server URL.-y
or--output-file
- Output file to save the operation results. If not provided, the default file the results saved is<organization>-gitlab-teams-<date-time>.csv
.-t
or--token
- Personal access token.-w
or--wait-time
- Delay time (in seconds) to wait between requests. Default value is 1 second.
No input is required.
name | slug | privacy | description | parentTeam |
---|---|---|---|---|
Sample Team | sample-team | closed | sample team desc | parent-team |
Exports team members of a gitlab organization.
git-migrator export-gitlab-team-members
-o
or--organization
- Organization name.-f
or--input-file
- Input file name with team names.-b
or--batch-size
- Batch size for requests.-g
or--server-url
- The gitlab server URL.-y
or--output-file
- Output file to save the operation results. If not provided, the default file the results saved is<organization>-gitlab-team-members-<date-time>.csv
.-t
or--token
- Personal access token.-w
or--wait-time
- Delay time (in seconds) to wait between requests. Default value is 1 second.
team |
---|
team-1 |
member | team | role |
---|---|---|
test-user | team-1 | admin |
Exports users of a gitlab organization.
git-migrator export-gitlab-users
-o
or--organization
- Organization name.-b
or--batch-size
- Batch size for requests.-g
or--server-url
- The gitlab server URL.-y
or--output-file
- Output file to save the operation results. If not provided, the default file the results saved is<organization>-gitlab-users-<date-time>.csv
.-t
or--token
- Personal access token.-w
or--wait-time
- Delay time (in seconds) to wait between requests. Default value is 1 second.
No input is required
login |
---|
test-user |
Adds or removes members from a github organization.
git-migrator import-github-membership-in-org
-f
or--input-file
- Input file name with member name.-o
or--organization
- Organization name.-d
or--delete-member
- Boolean flag. If set then it will remove the members from the organization.-g
or--server-url
- The target GHES server endpoint url. If this argument is skipped then the target will the cloud instance.-y
or--output-file
- Output file to save the operation results. If not provided, the default file the results saved is<organization>-set-membership-in-org-status-<timestamp>.csv
. The output files logs the successfully deleted organization members.-t
or--token
- Personal access token.-s
or--skip
- Number of lines to skip in the input file. Default is set to 0.-w
or--wait-time
- Delay time (in seconds) to wait between requests. Default value is 1 second.
login |
---|
example-user |
login | status | statusText | errorMessage |
---|---|---|---|
example-user | Success |
Imports teams to a github organization.
git-migrator import-github-teams
-f
or--input-file
- Input file name with teams info.-o
or--organization
- Organization name.-z
or--github-user
- GitHub username who is performing the operation, to delete the user after the team is created, because by default when a team is created, the user who created it will be added to the team.-g
or--server-url
- The target GHES server endpoint url. If this argument is skipped then the target will the cloud instance.-y
or--output-file
- Output file to save the operation results. If not provided, the default file the results saved is<organization>-create-teams-status-<timestamp>.csv
. The output file logs the names of the successfully migrated team names.-t
or--token
- Personal access token.-s
or--skip
- Number of lines to skip in the input file. Default is set to 0.-w
or--wait-time
- Delay time (in seconds) to wait between requests. Default value is 1 second.
name | id | slug | combinedSlug | description | privacy | url | repositories | repositoriesCount | childTeams | members | membersCount | parentTeam | parentTeamId | repositoriesUrl | repositoriesResourcePath | resourcePath | createdAt | updatedAt |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Sample Team | 123 | sample-team | org/sample-team | Desc | closed | https://url.com | repo-name:permission | 1 | null | abc:[email protected]:role | 1 | parent-team-slug | 2 | https://url.com | /orgs/org/teams/owners/repositories | /orgs/org/teams/owners | 2018-11-02T21:22:15Z | 2018-11-02T21:22:15Z |
Required fields in the input CSV file are:
- name
- description
- privacy
- parentTeam - Slug of the parent team
- slug
team | status | statusText | errorMessage |
---|---|---|---|
team a | Success | ||
team b | Success |
Imports members to teams with the specified roles.
git-migrator import-github-team-members
-f
or--input-file
- Input file name with teams, member, and roles.-o
or--organization
- Organization name.-g
or--server-url
- The target GHES server endpoint url. If this argument is skipped then the target will the cloud instance.-y
or--output-file
- Output file to save the operation results. If not provided, the default file the results saved is<organization>-insert-team-members-status-<timestamp>.csv
. The output files logs the successfully inserted teams members.-t
or--token
- Personal access token.-s
or--skip
- Number of lines to skip in the input file. Default is set to 0.-w
or--wait-time
- Delay time (in seconds) to wait between requests. Default value is 1 second.
member | team | role |
---|---|---|
example-user | sample-team | MEMBER |
To migrate the team members from GHES to GHEC, use the team members output file of get-teams operation.
Adds or removes direct collaborators of repositories in an organization.
git-migrator import-github-repo-collaborators
-f
or--input-file
- Input file name with repo, collaborators & roles info.-o
or--organization
- Organization name.-g
or--server-url
- The target GHES server endpoint url. If this argument is skipped then the target will the cloud instance.-y
or--output-file
- Output file to save the operation results. If not provided, the default file the results saved is<organization>-set-repo-collaborators-status-<timestamp>.csv
. This output file logs the successful collaborators requests to repositories.-t
or--token
- Personal access token.-r
or--repos-file
- File with repos names so only those repos will be considered. Should have the columnrepos
.-s
or--skip
- Number of lines to skip in the input file. Default is set to 0.-w
or--wait-time
- Delay time (in seconds) to wait between requests. Default value is 1 second.
repo | login | role |
---|---|---|
abc-repo | sample-user | admin |
repo | login | role | status | statusText | errorMessage |
---|---|---|---|---|---|
abc-repo | sample-user | admin | Success |
Imports teams with permissions to the repositories in an organization.
git-migrator import-github-repo-team-permission
-f
or--input-file
- Input file name with repo, team & permission info.-o
or--organization
- Organization name.-g
or--server-url
- The target GHES server endpoint url. If this argument is skipped then the target will the cloud instance.-y
or--output-file
- Output file to save the operation results. If not provided, the default file the results saved is<organization>-set-repo-team-permission-status-<timestamp>.csv
. This output file logs the successful teams permissions added to repositories.-t
or--token
- Personal access token.-r
or--repos-file
- File with repos names so only those repos will be considered. Should have the columnrepos
.-s
or--skip
- Number of lines to skip in the input file. Default is set to 0.-w
or--wait-time
- Delay time (in seconds) to wait between requests. Default value is 1 second.
repo | team | permission |
---|---|---|
abc-repo | sample-team | write |
Compares team metrics for GHES and GHEC for an organization.
git-migrator compare-teams -c <ghec-file> -s <ghes-file>
-c
or--ghec-file
- GHEC team metrics file.-s
or--ghes-file
- GHES team metrics file.-o
or--organization
- Organization name.-y
or--output-file
- Output file to save the operation results. Default file names are discussed on the output section.-u
or--users-file
- File with user names so only those users will be considered. Should have the column namelogin
.
name | id | slug | combinedSlug | description | privacy | url | repositories | repositoriesCount | childTeams | members | membersCount | parentTeam | parentTeamId | repositoriesUrl | repositoriesResourcePath | resourcePath | createdAt | updatedAt |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Sample Team | 123 | sample-team | org/sample-team | Desc | closed | https://url.com | repo-name:permission | 1 | null | abc:[email protected]:role | 1 | parent-team-slug | 2 | https://url.com | /orgs/org/teams/owners/repositories | /orgs/org/teams/owners | 2018-11-02T21:22:15Z | 2018-11-02T21:22:15Z |
Three files are generated as output files
a. Comparison file - Report of comparison of teams, members and repositories. Output file arguments overrides only this file.
Default file name - <organization>-teams-comparison.csv
Format
team | issue | repo | member |
---|---|---|---|
test-team | repositories-count-mismatch |
b. Repo permission file - File with repositories teams permission mismatch that can be used as input to add repositories team permission.
Default file name - <organization>-repo-team-permission-input.csv
Format
repo | team | permission |
---|---|---|
test-repo | test-team | admin |
c. Member role file - File with members missing in teams as well as wrong permissions. It can be used to fix the mismatches as input for insert-team-members
script.
Default file name - <organization>-member-team-role-input.csv
Format
member | team | role |
---|---|---|
abc | test-team | write |
Compares repo direct collaborators between GHES and GHEC in an organization.
git-migrator compare-repo-direct-collaborators -c <ghec-file> -s <ghes-file>
-c
or--ghec-file
- GHEC repo direct collaborators file.-s
or--ghes-file
- GHES repo direct collaborators file.-o
or--organization
- Organization name.-u
or--users-file
- File with user names so only those users will be considered. Should have the column namelogin
.z
or--outside-collaborators-file
- File with outside collaborators names to not be included.
repo | login | role |
---|---|---|
test-repo | abc | admin |
Two files are generated as output files.
a. Direct collaborators input file - File with direct collaborators that need to be added to GHEC after comparison.
Default file name - <organization>-repo-direct-collaborators-input.csv
Format
repo | login | role |
---|---|---|
test-repo | abc | admin |
b. Direct collaborators remove file - File with input to remove collaborators permission. The collaborators permission might be outdated, so it is necessary to those permissions.
Default file name - <organization>-repo-direct-collaborators-remove.csv
Format
repo | login |
---|---|
test-repo | xyz |
Compares the last commits of all branches of every repositories between source and target organizations
git-migrator ghec-last-commit-check -p <ghec-organization> -q <source-organization> -h <source token> -t <target-token> -g <server-url>
-o
or--organization
- Organization name.-f
or--input-file
- Input file name with teams, member, and roles.-g
or--server-url
- The target GHES server endpoint url. If this argument is skipped then the target will be the cloud instance.p
or--source-organization
- Source organization name.q
or--target-organization
- Target (GHEC) organization name-b
or--batch-size
- Batch size for GraphQL request.-y
or--output-file
- Output file to save the operation results. The default format is discussed below. Default file name is<organization>-metrics/<source-organization>-<target-organization>-last-commit-check-<date>.csv
. date - Format is DD/MM/YYYY-t
or--token
- Personal access token of the target organization- If not provided, then the user wil be prompted to input the token.-s
or--skip
- Number of lines to skip in the input file. Default is set to 0.-w
or--wait-time
- Delay time (in seconds) to wait between requests. Default value is 1 second.
Input is optional, a CSV file with header repo
.
repo |
---|
sample-repo |
Archive or unarchive repositories in a github organization.
git-migrator set-github-archived-status
-f
or--input-file
- Input file name with repo, team & permission info.-o
or--organization
- Organization name.-g
or--server-url
- The target GHES server endpoint url. If this argument is skipped then the target will the cloud instance.-y
or--output-file
- Output file to save the operation results. If not provided, the default file the results saved is<organization>-set-archived-status-<timestamp>.csv
. This output file logs the successful requests.-t
or--token
- Personal access token.-s
or--skip
- Number of lines to skip in the input file. Default is set to 0.-u
or--unarchive
- Boolean value, if set it will unarchive archived repos, if not set it will archive repos.-w
or--wait-time
- Delay time (in seconds) to wait between requests. Default value is 1 second.
repo |
---|
abc-repo |
repo | status | statusText | errorMessage |
---|---|---|---|
abc-repo | Success |
Delete repositories in an organization.
git-migrator delete-github-repos
-f
or--input-file
- Input file name with repository names to delete.-o
or--organization
- Organization name.-g
or--server-url
- The target GHES server endpoint url. If this argument is skipped then the target will the cloud instance.-y
or--output-file
- Output file to save the operation results. If not provided, the default file the results saved is<organization>-delete-repos-status-<timestamp>.csv
. This output file logs the successful repositories deleted from the organization.-t
or--token
- Personal access token.-s
or--skip
- Number of lines to skip in the input file. Default is set to 0.-w
or--wait-time
- Delay time (in seconds) to wait between requests. Default value is 1 second.
repo |
---|
abc-repo |
repo | status | statusText | errorMessage |
---|---|---|---|
abc-repo | Success |
Exports outside collaborators of an organization.
git-migrator export-github-outside-collaborators
-o
or--organization
- Organization name.-g
or--server-url
- The target GHES server endpoint url. If this argument is skipped then the target will the cloud instance.-y
or--output-file
- Output file to save the operation results. If not provided, the default file the results saved is<organization>-outside-collaborators-<timestamp>.csv
.-t
or--token
- Personal access token.-u
or--users-file
- File with user names so only those users will be considered. Should have the column namelogin
.-w
or--wait-time
- Delay time (in seconds) to wait between requests. Default value is 1 second.
No input file is required
login |
---|
sample-user1 |
samples-user2 |
Fetches secret variables from source repo and sets the corresponding secret variables in the target repo.
./migrate_secrets.sh -i [input_csv] [-s [source_token]] [-t [destination_token]] [-z [override_destination_org]] [-y [override_destination_repo_prefix]] [-a [ghes_hostname]] [-l [log_file]]
-i
- input_csv - A CSV with source_org,source_repo,destination_org,destination_repo.-s
- source_token - Source system token (optional, if not provided, GH_SRC_PAT environment variable will be used).-t
- destination_token - Destination system token (optional, if not provided, GH_DEST_PAT environment variable will be used).-z
- override_destination_org - Override destination org with this value (optional, useful for testing).-y
- override_destination_repo_prefix - Prepend prefix to destination repo names (optional, useful for testing).-a
- ghes_hostname - GHES hostname (not API URL, optional, required for GHES).l
- log_file - Log file path (optional, default: migrate_secrets.log).
Checks the downloaded migration log files to see which ones completed successfully and how long the migration took.
./check_migrations.sh [-d [directory]] [-l [log_file]]
d
- directory - The directory where the migration log files are located. If no directory is provided, it checks the current working directory for the log files.l
- log_file - Log file path (optional, default: check_migrations.log).
Examines a directory containing all the log files after starting migrations with the GEI tool, and finds which ones failed with errors.
./find_log_errors.sh [-d [directory]] [-l [log_file]]
d
- directory - The directory where the migration log files are located. If no directory is provided, it checks the current working directory for the log files.l
- log_file - Log file path (optional, default: find_log_errors.log).
This script compares migration data between source and destination GitHub organizations based on provided input, downloading necessary data files, and generating a CSV report indicating match status along with signatures of repositories.
./compare_migrations.sh -i [input_csv] -o [output_csv] -s [source_token] -t [destination_token] -a [source_api_graphql_url] [-p [path_to_analyzer]] [-w [working_directory]] [-z [override_destination_org]] [-y [override_destination_repo_prefix]] [-l [log_file]]
-i
- input_csv - A CSV with source_org,source_repo,destination_org,destination_repo.-o
- output_csv - A CSV file with match,source_org,source_repo,source_signature,target_org,target_repo,target_signature.-s
- source_token - Source system token (optional, if not provided, GH_SRC_PAT environment variable will be used).-t
- destination_token - Destination system token (optional, if not provided, GH_DEST_PAT environment variable will be used).-z
- override_destination_org - Override destination org with this value (optional, useful for testing).-y
- override_destination_repo_prefix - Prepend prefix to destination repo names (optional, useful for testing).-a
- source_api_graphql_url - Source system API GRAPHQL URL (optional, required for GHES).-p
- path_to_analyzer - Path to the GitHub migration analyzer (optional, default: ./gh-migration-analyzer).w
- working_directory - Working directory (optional, uses a new temporary directory if not specified).l
- log_file - Log file path (optional, default: compare_migrations.log).
Node V16+
Run the command:
npm run test
See Contribution Guidelines and Code of Conduct.
Modus Create is a digital product consultancy. We use a distributed team of the best talent in the world to offer a full suite of digital product design-build services; ranging from consumer facing apps, to digital migration, to agile development training, and business transformation.
This project is MIT licensed.