Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/andyfeller/gh-repo-export
GitHub CLI extension to generate GitHub repository migrations
https://github.com/andyfeller/gh-repo-export
gh-extension
Last synced: 2 months ago
JSON representation
GitHub CLI extension to generate GitHub repository migrations
- Host: GitHub
- URL: https://github.com/andyfeller/gh-repo-export
- Owner: andyfeller
- Created: 2022-09-30T18:15:29.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-09-29T00:17:01.000Z (about 1 year ago)
- Last Synced: 2023-09-29T02:29:09.951Z (about 1 year ago)
- Topics: gh-extension
- Language: Shell
- Homepage:
- Size: 39.1 KB
- Stars: 11
- Watchers: 2
- Forks: 6
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# gh-repo-export
A `gh` extension to generate [GitHub organization repository migrations](https://docs.github.com/en/enterprise-cloud@latest/rest/migrations/orgs).
## Quickstart
1. Download and install [jq](https://stedolan.github.io/jq/download/)
1. `gh extension install andyfeller/gh-repo-export`
1. `gh repo-export ...`
1. Profit! :moneybag: :money_with_wings: :money_mouth_face: :money_with_wings: :moneybag:## Usage
> **Note**
> `gh-repo-export` requires the use of coarse-grained v1 PAT token with `repo` and `admin:org` scopes.```shell
$ gh repo-export --helpBulk exports a list of Git repositories from an organization
USAGE
gh repo-export [flags] ...
gh repo-export [flags]FLAGS
--archive=string Name of archive excluding extension; default 'migration-archive-'
--archive-per-repo Generates 1 archive per repository instead of 1 archive for all repositories
-d, --debug Enable debugging
--exclude-attachments Indicates attachments should be excluded from the migration
--exclude-git-data Indicates git data should be excluded from the migration
--exclude-metadata Indicates metadata should be excluded from the migration
--exclude-owner-projects Indicates projects owned by the organization or users should be excluded from the migration
--exclude-releases Indicates releases should be excluded from the migration
-h, --help Display help usage
--hostname=string Hostname of the GitHub instance to authenticate with
--lock-repositories Indicates repositories should be locked (to prevent manipulation) while migrating data
--skip-download Skip downloading the archive(s), instead outputting the URL(s) to stdout (curl and sed required)EXAMPLES
# Generate 1 archive containing test1 repository, reading repositories from arguments
$ gh repo-export tinyfists test1# Generate 1 archive containing both test1 and test2 repositories, reading repositories from arguments
$ gh repo-export tinyfists test1 test2# Generate 1 archive containing both test1 and test2 repositories, reading repositories from arguments, and output the archive URL instead of downloading
$ gh repo-export --skip-download tinyfists test1 test2# Generate 2 archives, 1 containing test1 repository and 1 containing test2 repository, reading repositories from arguments
$ gh repo-export --archive-per-repo tinyfists test1 test2# Generate 2 archives, 1 containing test1 repository and 1 containing test2 repository, reading repositories from 'repos.txt' file
$ gh repo-export --archive-per-repo tinyfists repos.txt
```### Examples
$ gh repo-export tinyfists issue-driven-github-admin
```shell
Reading repositories from arguments: issue-driven-github-admin
Starting migration 3431913 for repositories: issue-driven-github-admin
Watching migration 3431913 with 'exporting' state
Watching migration 3431913 with 'exporting' state
Watching migration 3431913 with 'exporting' state
Watching migration 3431913 with 'exported' state
Downloading migration 3431913 archive to migration-archive-3431913.tar.gz
```
$ gh repo-export tinyfists issue-driven-github-admin actions-experiments
```shell
Reading repositories from arguments: issue-driven-github-admin actions-experiments
Starting migration 3431922 for repositories: issue-driven-github-admin actions-experiments
Watching migration 3431922 with 'exporting' state
Watching migration 3431922 with 'exporting' state
Watching migration 3431922 with 'exporting' state
Watching migration 3431922 with 'exporting' state
Watching migration 3431922 with 'exported' state
Downloading migration 3431922 archive to migration-archive-3431922.tar.gz
```
$ gh repo-export --skip-download tinyfists issue-driven-github-admin actions-experiments
```shell
Reading repositories from arguments: issue-driven-github-admin actions-experiments
Starting migration 3431922 for repositories: issue-driven-github-admin actions-experiments
Watching migration 3431922 with 'exporting' state
Watching migration 3431922 with 'exporting' state
Watching migration 3431922 with 'exporting' state
Watching migration 3431922 with 'exporting' state
Watching migration 3431922 with 'exported' state
Archive URL for migration 3762306: https://github-cloud.s3.amazonaws.com/migration/...
```
$ gh repo-export --archive-per-repo tinyfists issue-driven-github-admin actions-experiments
```shell
Reading repositories from arguments: issue-driven-github-admin actions-experiments
Starting migration 3431937 for repositories: issue-driven-github-admin
Starting migration 3431938 for repositories: actions-experiments
Watching migration 3431937 with 'exporting' state
Watching migration 3431938 with 'exporting' state
Watching migration 3431937 with 'exporting' state
Watching migration 3431938 with 'exported' state
Watching migration 3431937 with 'exporting' state
Watching migration 3431937 with 'exported' state
Downloading migration 3431937 archive to migration-archive-3431937.tar.gz
Downloading migration 3431938 archive to migration-archive-3431938.tar.gz
```
$ gh repo-export tinyfists repos.txt
```shell
Reading repositories from file: repos.txt
Starting migration 3431982 for repositories: issue-driven-github-admin actions-experiments
Watching migration 3431982 with 'exporting' state
Watching migration 3431982 with 'exporting' state
Watching migration 3431982 with 'exporting' state
Watching migration 3431982 with 'exported' state
Downloading migration 3431982 archive to migration-archive-3431982.tar.gz
```## Setup
Like any other `gh` CLI extension, `gh-repo-export` is trivial to install or upgrade and works on most operating systems:
- **Installation**
```shell
gh extension install andyfeller/gh-repo-export
```
_For more information: [`gh extension install`](https://cli.github.com/manual/gh_extension_install)_- **Upgrade**
```shell
gh extension upgrade gh-repo-export
```_For more information: [`gh extension upgrade`](https://cli.github.com/manual/gh_extension_upgrade)_