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.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 clone-repo 2.0.1
File Size Uploaded Provenance Actions
clone_repo-2.0.1.tar.gz 6.3 kB Without provenance Details for clone_repo-2.0.1.tar.gz

Built distribution (wheel)

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

Total release size: 12.4 kB

Release files / clone_repo-2.0.1.tar.gz

Download URL clone_repo-2.0.1.tar.gz
Size 6.3 kB
Tags Source
SHA-256 checksum
How to use checksums
2cb50c149fa228a16686b42f2d23587f818197ea99468b69a1eb6ccc351e01e4
BLAKE2b-256 checksum
How to use checksums
b68f3357dbf74bdb337251354410619d92b1fc28d0f111daa1601acd4872df73
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.1-py3-none-any.whl

Download URL clone_repo-2.0.1-py3-none-any.whl
Size 6.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
55f1cf8fa801e2e7d1fce7df11199a65a84053c1da6049cd03f2c626f25f4f4e
BLAKE2b-256 checksum
How to use checksums
18f8f1fd53188237d27bb0a29ad557be6b350ec9bdc7ecde70c3e0e1ed0df25b
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.1

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