Skip to main content

git-clone-all

📦 Clone all public repositories of a GitHub user or organization

CategoryStack
LanguageTypeScript
CLIcommander
Buildtsdown
TestVitest
Lintoxlint, oxfmt

Install#

sh
npm install -g git-clone-all

Or run it without installing:

sh
npx git-clone-all <username>

Requires Node.js 22.13 or later and git.

Usage#

text
Usage: git-clone-all [options] <username>
Clone all public repositories of a GitHub user or organization
Arguments:  username               GitHub user or organization
Options:  -V, --version          output the version number  -H, --https            clone by https (default)  -S, --ssh              clone by ssh  -d, --dir <dir>        directory to clone into (default: ".")  -c, --concurrency <n>  number of parallel clones (default: 4)  --no-forks             skip forked repositories  --no-archived          skip archived repositories  -p, --pull             pull repositories that already exist instead of                         skipping them  -h, --help             display help for command
sh
git-clone-all tlyboy                 # clone into the current directorygit-clone-all tlyboy -d ~/i/tlyboy   # clone into another directorygit-clone-all tlyboy --ssh --no-forks --no-archivedgit-clone-all tlyboy --pull          # update repositories that already exist
  • Repositories that already exist are skipped, or pulled with --pull (fast-forward only).
  • Clones run in parallel (4 by default). A failed clone doesn't stop the others; the exit code is 1 if any failed.

Authentication#

Unauthenticated GitHub API calls are limited to 60 per hour. The token is taken from GITHUB_TOKEN, then GH_TOKEN, then gh auth token if the GitHub CLI is logged in. Only public repositories are listed.

Development#

sh
pnpm installpnpm buildpnpm testpnpm lintpnpm formatpnpm typecheck

Release#

sh
pnpm release

bumpp bumps the version, commits, tags and pushes. The tag triggers the release workflow, which stages the package on npm with trusted publishing (provenance included) and creates a GitHub release with changelogithub. The version goes live after a maintainer approves it with 2FA on the package's Staged Packages tab on npmjs.com, or with npm stage approve <stage-id>.

License#

MIT © tlyboy