Skip to main content

CLI tool to clone repos easily

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

clone_repo-1.0.0.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

clone_repo-1.0.0-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file clone_repo-1.0.0.tar.gz.

File metadata

  • Download URL: clone_repo-1.0.0.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.13.8 Darwin/22.6.0

File hashes

Hashes for clone_repo-1.0.0.tar.gz
Algorithm Hash digest
SHA256 b52c62952c34e7af0eba44947601ef602f76339ae4957d979e96443f314ea81e
MD5 d9909b7fd0673e8cf631c3507fad564f
BLAKE2b-256 fc4ff04e6765d421493bbea3286d391599efac2bfd1bbf30c9feb9deb3ba92e1

See more details on using hashes here.

File details

Details for the file clone_repo-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: clone_repo-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.13.8 Darwin/22.6.0

File hashes

Hashes for clone_repo-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a418da49b508d19b48f5035fcd4877ff6ea4ad44ee0d811d73140c03ceddd94e
MD5 80a7093c2cccc7df4b078236ee474043
BLAKE2b-256 f6d1ac6c6e07ed79b737622f92d990ac57b57b713fca59734e3a15f92390b6e6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page