gh clone
is a gh
extension to clone a repository, in my preferred repository structure
$ gh extension install AaronMoat/gh-clone
I like to have a root directory for all repositories, then a sub-directory for each owner:
$ cd /users/me
$ gh clone some-owner/some-repo
First run. Enter the location where you want to clone repositories: /users/me/code
Cloning into '/users/me/code/some-owner/some-repo'...
...
Cloned to /users/me/code/some-owner/some-repo
It will infer the owner from the current directory if not provided:
$ cd /users/me/code/some-owner
$ gh clone some-other-repo
Cloning into some-other-repo
Cloned to /users/me/code/some-owner/some-other-repo
Otherwise, if you're not in an inferrable location, the inferred owner will be yourself:
$ cd /users/me
$ gh clone some-repo
Cloning into some-repo
Cloned to /users/me/code/MyGitHubUsername/some-repo
There is no support for specifying owner syntaxes like git@...
, https://...
, or git://...
.