Skip to main content

clone-repo: Easily clone repos

What is this?

For years I've been using a noddy script which clones many types of repos into a fixed location which is generated based on the repo itself. Similar to how go packages are cloned into go/src I typically clone my stuff into ~/src.

e.g. clone-repo git@github.com:micktwomey/clone-repo.git will clone using git to ~/src/github.com/micktwomey/clone-repo.

This allows me to clone many different repos without worrying about stepping on each other. It also makes it easy to see where stuff comes from (e.g. rm -rf ~/src/old.git.example.com will wipe out clones from git server I don't use any more).

Install via pip install clone-repo.

Install with pipx using pipx install clone-repo to make it available as a CLI tool everywhere.

Supports:

  • /path/to/repo
    • git clone to ~/src/localhost/file/{repo}
  • file:///path/to/repo
    • git clone to ~/src/localhost/file/{repo}
  • git@example.com:org/repo.git
    • git clone to ~/src/{host}/{org}/{repo}
  • https://github.com/org/repo.git
    • git clone to ~/src/github.com/{org}/{repo}
  • https://github.com/org/repo
    • git clone to ~/src/github.com/{org}/{repo}
  • https://gitlab.example.com/org/repo.git
    • git clone to ~/src/{host}/{org}/{repo}
  • https://hg.mozilla.org/mozilla-central/
    • hg clone to ~/src/hg.mozilla.org/{org}/{repo}
  • https://hg.sr.ht/~org/repo
    • hg clone to ~/src/hg.sr.ht/{org}/{repo}
  • keybase://team/org/repo
    • git clone to ~/src/keybase/{org}/{repo}
  • man@man.sr.ht:~org/repo
    • git clone to ~/src/man.sr.ht/{org}/{repo}
  • ssh://git@example.com:7999/somegroup/myrepo.git
    • git clone to ~/src/{host}/{org}/{repo}
  • ssh://hg@bitbucket.org/org/repo
    • hg clone to ~/src/{host}/{org}/{repo}

For https:// URLs the default is git but some will behave differently based on the domain.

Development

If you want to quickly develop you can use poetry and pytest:

  1. poetry install
  2. pytest -vv

If you want to test across all supported Python versions you can install them via asdf and then use nox:

  1. asdf install
  2. poetry install
  3. nox

If you want to run pre-commit hooks before committing:

  1. poetry install
  2. pre-commit install

Finally, there is a just justfile to run some commands.

Metadata

Release files for clone-repo 2.0.0

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

Source distribution (sdist)

Source distribution for clone-repo 2.0.0
File Size Uploaded Provenance Actions
clone_repo-2.0.0.tar.gz 6.3 kB Without provenance Details for clone_repo-2.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for clone-repo 2.0.0
File Interpreter ABI Platform Actions
clone_repo-2.0.0-py3-none-any.whl Python 3 none any Details for clone_repo-2.0.0-py3-none-any.whl

Total release size: 12.4 kB

Release files / clone_repo-2.0.0.tar.gz

Download URL clone_repo-2.0.0.tar.gz
Size 6.3 kB
Tags Source
SHA-256 checksum
How to use checksums
8e0fd81c8f9db8bb814e18226b0d13ce7eb94089f7d70539dbc64d626db96abd
BLAKE2b-256 checksum
How to use checksums
2c13160071bfad676e698b581ad4b4457ec09bcaeb17620a036b89fe0e1a2461
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.14.9 Darwin/27.0.0

Release files / clone_repo-2.0.0-py3-none-any.whl

Download URL clone_repo-2.0.0-py3-none-any.whl
Size 6.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7b26c9e9863c705e516ddae87a930a6b82cbffe2393223d15657205e18620977
BLAKE2b-256 checksum
How to use checksums
4a701a689d86f1f2e9ec291b2494cea1150384adff32cbda89792ba3ba141aa1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.14.9 Darwin/27.0.0

Security for clone-repo 2.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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