Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/AaronMoat/gh-clone

GitHub CLI (gh) extension to clone repositories in a nested directory structure
https://github.com/AaronMoat/gh-clone

gh-extension

Last synced: 3 months ago
JSON representation

GitHub CLI (gh) extension to clone repositories in a nested directory structure

Awesome Lists containing this project

README

        

# `gh clone`

`gh clone` is a [`gh` extension](https://docs.github.com/en/github-cli/github-cli/using-github-cli-extensions) to clone a repository, in my preferred [repository structure](#usage--repository-structure)

## Installation

```shell
$ gh extension install AaronMoat/gh-clone
```

## Usage & Repository Structure

I like to have a root directory for all repositories, then a sub-directory for each owner:

```shell
$ 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:

```shell
$ 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:

```shell
$ 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://...`.