Skip to content

ChrisCummins/gh-archiver

Repository files navigation

gh-archiver

Mirror a GitHub user's repos locally.

This program fetches a GitHub user's repositories and mirrors them to a local directory. New repositories are cloned, existing repositories are fetched from remote.

Setup

Create a Github personal access token. If you intend to mirror your own private repositories, select "repo" from the list of available scopes. To mirror only your public repositories or those another user, no scopes are required.

Create a ~/.github/access_tokens/gh_archiver.txt file containing your the personal access token you just created:

$ mkdir -p ~/.github/access_tokens
$ cat <<EOF > ~/.github/access_tokens/gh_archiver.txt
YourAccessToken
EOF
$ chmod 0600 ~/.github/access_tokens/gh_archiver.txt

Then build and install the gh_archiver program using:

$ basel run -c opt //datasets/github/gh_archiver:install

Requires Python >= 3.6.

Usage

Mirror a Github user's repositories to a directory using:

$ gh_archiver --user <github_username> --outdir <path>

License

Made with ❤️ by Chris Cummins. Released under MIT License.