Addition to GitHub CLI that clones all public and private repositories. It uses GitHub CLI and its authentication system and passes the filter options through to gh repo list.
npm install gh-repo-clone-all
src="https://img.shields.io/npm/v/gh-repo-clone-all.svg"
alt="npm version"
>
src="https://github.com/dword-design/gh-repo-clone-all/workflows/build/badge.svg"
alt="Build status"
>
src="https://codecov.io/gh/dword-design/gh-repo-clone-all/branch/master/graph/badge.svg"
alt="Coverage status"
>
src="https://gitpod.io/button/open-in-gitpod.svg"
alt="Open in Gitpod"
width="114"
>
src="https://www.buymeacoffee.com/assets/img/guidelines/download-assets-sm-2.svg"
alt="Buy Me a Coffee"
width="114"
>
src="https://sebastianlandwehr.com/images/paypal.svg"
alt="PayPal"
width="163"
>
src="https://sebastianlandwehr.com/images/patreon.svg"
alt="Patreon"
width="163"
>
Addition to GitHub CLI that clones all public and private repositories. It uses GitHub CLI and its authentication system and passes the filter options through to gh repo list.
``bashnpm
$ npm install -g gh-repo-clone-all
Usage
First of all, you need to have GitHub CLI installed. You can find out by running
gh version. Also make sure that you are logged in so that gh-repo-clone-all can fetch the repository list. You can find out by running gh auth status.Now we can run the command like this:
`bash
Usage: gh-repo-clone-all [directory] [options] [gh repo list options] You can pass the supported options through from gh repo list. The options below are additional.
Options:
-b, --branch The branch to checkout
-h, --help display help for command
`See the gh repo list docs for details about the filtering options.
Cloning
The simplest case is to just clone into the current directory (which has to be empty):
`bash
$ gh-repo-clone-allCloning into /Users/foobar/repos …
Successfully cloned john-doe/repo1.
Successfully cloned john-doe/repo2.
Successfully cloned john-doe/repo3.
Successfully cloned john-doe/repo4.
Done!
`Usually you will want to provide a directory name, which is then created:
`bash
$ gh-repo-clone-all my-repos
`gh repo list has a default limit of 30, which is rather low. So let's put it up to clone more repositories:`bash
$ gh-repo-clone-all my-repos --limit 100
`You can actually just put a very high limit to clone everything:
`hash
$ gh-repo-clone-all my-repos --limit 9999
`Checking Out a Branch
Instead of the default branch, you can checkout a specific branch like this:
`bash
$ gh-repo-clone-all my-repos --branch renovate/lock-file-maintenance
`Note that if a branch cannot be checked out by a repository, the repository will not be cloned.
Filtering
You can use the filtering options from gh repo list to filter the repositories you would like to clone:
`bashClone only archived repositories
$ gh-repo-clone-all --archivedClone only forks
$ gh-repo-clone-all --forkClone only repositories of a language
$ gh-repo-clone-all --language langClone up to a limit
$ gh-repo-clone-all --limit xDo not clone archived repositories
$ gh-repo-clone-all --no-archivedClone only private repositories
$ gh-repo-clone-all --sourceClone only public repositories
$ gh-repo-clone-all --publicClone only non-forks
$ gh-repo-clone-all --source
`The Git Protocol
gh-repo-clone-all uses the protocol defined in GitHub CLI to clone repositories. You can find out which via gh config get git_protocol, and you can set it via gh config set git_protocol [ssh,https]`.Are you missing something or want to contribute? Feel free to file an issue or a pull request! ⚙️
Hey, I am Sebastian Landwehr, a freelance web developer, and I love developing web apps and open source packages. If you want to support me so that I can keep packages up to date and build more helpful tools, you can donate here:
src="https://www.buymeacoffee.com/assets/img/guidelines/download-assets-sm-2.svg"
alt="Buy Me a Coffee"
width="114"
>
If you want to send me a one time donation. The coffee is pretty good 😊.
src="https://sebastianlandwehr.com/images/paypal.svg"
alt="PayPal"
width="163"
>
Also for one time donations if you like PayPal.
src="https://sebastianlandwehr.com/images/patreon.svg"
alt="Patreon"
width="163"
>
Here you can support me regularly, which is great so I can steadily work on projects.
Thanks a lot for your support! ❤️