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.

Release files for clone-repo 1.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 1.0.1
File Size Uploaded
clone_repo-1.0.1.tar.gz 6.2 kB Details

Built distribution (wheel)

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

Total release size: 12.2 kB

Release files / clone_repo-1.0.1.tar.gz

Download URL clone_repo-1.0.1.tar.gz
Size 6.2 kB
Tags Source
SHA-256 checksum
How to use checksums
3386211b38935beaebf2c77c40d167b69dab62b5deb9c9871106c2bcfbfb2931
BLAKE2b-256 checksum
How to use checksums
52bfd534789925af51820c14851e0d4d9f31b0f2799f0d9879bdd29632a69226
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.1 CPython/3.13.8 Darwin/22.6.0

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

Download URL clone_repo-1.0.1-py3-none-any.whl
Size 6.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bf3851de97bea717fca0383c46fb00c93e55e3473db26811fbd3636dbe011d20
BLAKE2b-256 checksum
How to use checksums
ec9dd03812ee35c790e31496e9afe0f7a34d66bf54a97f1724c2cfa1134305b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.1 CPython/3.13.8 Darwin/22.6.0

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

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