Skip to main content

GitHub Organization Repository Sync

github-repository-sync.py finds all repositories for a GitHub organization and checks whether they already exist locally under a recursive search root.

Repositories that are missing locally are cloned into <root>/<org>/<repo> by default. The script detects existing local repositories by inspecting their Git remotes, so repositories can be located in nested folders.

The script uses named arguments only. There are no positional arguments.

Dependencies

  • Python 3.10 or newer
  • Git
  • GitHub CLI (gh), recommended for private repositories

Authentication options:

  • Use an authenticated GitHub CLI session with gh auth login.
  • Or set GITHUB_TOKEN or GH_TOKEN.
  • Or pass a token with --token.

Without authentication, GitHub only returns public repositories.

How to use

Run the script with the organization name:

./github-repository-sync.py --org kaizten

By default, the script searches recursively under ~ and clones missing repositories into ~/kaizten.

Use --dry-run to preview the missing repositories and clone destinations without cloning anything:

./github-repository-sync.py --org kaizten --dry-run

Use --root to search and clone under a different directory:

./github-repository-sync.py --org kaizten --root /home/christopher

Use --clone-dir to clone missing repositories somewhere other than <root>/<org>:

./github-repository-sync.py --org kaizten --clone-dir /home/christopher/repos

If a clone destination already exists and is not empty, the script chooses the next available suffixed directory, such as repo-1.

Examples

Preview missing repositories for kaizten:

./github-repository-sync.py --org kaizten --dry-run

Clone all missing repositories for kaizten under the default root:

./github-repository-sync.py --org kaizten

Search under /home/christopher and clone missing repositories under /home/christopher/kaizten:

./github-repository-sync.py --org kaizten --root /home/christopher

Clone using SSH URLs:

./github-repository-sync.py --org kaizten --protocol ssh

Skip archived repositories:

./github-repository-sync.py --org kaizten --exclude-archived

Use an explicit GitHub token:

./github-repository-sync.py --org kaizten --token YOUR_GITHUB_TOKEN

Metadata

Release files for github-repository-sync 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for github-repository-sync 0.0.1
File Size Uploaded
github_repository_sync-0.0.1.tar.gz 6.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for github-repository-sync 0.0.1
File Interpreter ABI Platform
github_repository_sync-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 13.3 kB

Release files / github_repository_sync-0.0.1.tar.gz

Download URL github_repository_sync-0.0.1.tar.gz
Size 6.9 kB
Tags Source
SHA-256 checksum
How to use checksums
6a0c722f0cf4c3233332b3a84b32703e6f6d25471d17830bcf537c37b9513dc1
BLAKE2b-256 checksum
How to use checksums
c3a8cbacfc5780d02a633cee994888ef79a5d6f4fa30235be22a2a68a7767690
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Release files / github_repository_sync-0.0.1-py3-none-any.whl

Download URL github_repository_sync-0.0.1-py3-none-any.whl
Size 6.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
839ae2116c89fa931c32646851a492218f53aea81b42cfe8b91d9e6fa2b292af
BLAKE2b-256 checksum
How to use checksums
3c71109737aacb4526dbc38f3f02c203ee4cbcf397c4d355f9aab67e6e5c2100
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page