Skip to content

Commit 11c4df2

Browse files
committed
extended readme
1 parent f9fa7fd commit 11c4df2

2 files changed

Lines changed: 104 additions & 8 deletions

File tree

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
include:
1515
- os: ubuntu-20.04
1616
artifact_name: gitclone
17-
asset_name: gitclone-linux-amd64-20.04
17+
asset_name: gitclone-linux-amd64
1818
- os: ubuntu-18.04
1919
artifact_name: gitclone
2020
asset_name: gitclone-linux-amd64-18.04

README.md

Lines changed: 103 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
# `> gitclone`
1+
```
2+
__ _ __ __
3+
\ \ ____ _(_) /______/ /___ ____ ___
4+
\ \ / __ `/ / __/ ___/ / __ \/ __ \/ _ \
5+
/ / / /_/ / / /_/ /__/ / /_/ / / / / __/
6+
/_/ \__, /_/\__/\___/_/\____/_/ /_/\___/
7+
/____/
8+
```
29
cli tool to clone git repositories in the folder structure implied by the repository url
310

411
## Concept
@@ -37,20 +44,109 @@ git
3744
-----------------
3845
The benefits become even more apparent, when we have to work with multiple GitHub (Enterprise) or GitLab instances. Even more so because GitLab allows the use of nested groups.
3946
## Installation
47+
### Pre-built binaries
48+
pre-built binaries are available for Linux, MacOS and Windows.
49+
#### Linux
50+
```
51+
sudo wget https://github.com/mxcd/gitclone/releases/latest/download/gitclone-linux-amd64 -O /usr/local/bin/gitclone && sudo chmod +x /usr/local/bin/gitclone
52+
```
53+
#### MacOS 11 and newer (amd64)
54+
```
55+
sudo wget https://github.com/mxcd/gitclone/releases/latest/download/gitclone-macos-11-amd64 -O /usr/local/bin/gitclone && sudo chmod +x /usr/local/bin/gitclone
56+
```
57+
#### MacOS 11 and newer (apple silicon)
58+
```
59+
sudo wget https://github.com/mxcd/gitclone/releases/latest/download/gitclone-macos-11-apple -O /usr/local/bin/gitclone && sudo chmod +x /usr/local/bin/gitclone
60+
```
61+
#### MacOS 10.15 (amd64)
62+
```
63+
sudo wget https://github.com/mxcd/gitclone/releases/latest/download/gitclone-macos-10.15-amd64 -O /usr/local/bin/gitclone && sudo chmod +x /usr/local/bin/gitclone
64+
```
65+
#### Windows
66+
Go to the latest release page and download your binary:
67+
https://github.com/mxcd/gitclone/releases/latest
68+
Place it in `C:\Windows\System32\gitclone.exe`
69+
70+
### Build from source
71+
#### Prequisites
72+
73+
Make sure you have the latest version of rust installed:
74+
https://www.rust-lang.org/tools/install
75+
#### Clone & Build
76+
```
77+
git clone https://github.com/mxcd/gitclone
78+
cd gitclone
79+
cargo build --release
80+
sudo cp target/release/gitclone /usr/local/bin/gitclone
81+
sudo chmod u+x /usr/local/bin/gitclone
82+
```
83+
4084

4185
## Usage
86+
### Initialization
4287
Firstly, the root directory of the git provider needs to be initialized.
88+
Create a directory that will act as the root of your git provider.
89+
We encourage you to name the directory after the provider (e.g. `./github.com`)
4390
The base URL of the git provider will be prompted.
4491
```
45-
$> gitclone init
46-
git provider base url:
47-
github.com
48-
gitclone provider root registered
49-
$>
92+
$ mkdir github.com
93+
$ cd github.com
94+
$ gitclone init
95+
__ _ __ __
96+
\ \ ____ _(_) /______/ /___ ____ ___
97+
\ \ / __ `/ / __/ ___/ / __ \/ __ \/ _ \
98+
/ / / /_/ / / /_/ /__/ / /_/ / / / / __/
99+
/_/ \__, /_/\__/\___/_/\____/_/ /_/\___/
100+
/____/
101+
102+
=> Initializing gitclone root
103+
104+
please enter git provider base url including protocol
105+
for https connections: e.g. https://github.com
106+
for ssh connections: e.g. ssh://git@github.com
107+
108+
git provider base url:
109+
https://github.com
110+
111+
input http(s) basic auth credentials. leave blank if not required.
112+
WARNING: credentials will be stored in plain text in the root file. If you are uncomfortable with this please consider using ssh instead.
113+
114+
BasicAuth credentials: username:access-token-or-api-key
115+
116+
$
50117
```
118+
This will create a .gitclone_root.yml file in the directory marking it as root directory for the git provider.
51119

120+
### Cloning
52121
```
53122
gitclone <relative path>
54123
```
124+
This will clone the repository with respect to the relative path you have to the root directory.
125+
126+
### Examples
127+
#### Cloning from the root directory
128+
```
129+
$ pwd
130+
/home/user/github.com
131+
$ gitclone mxcd/api-template
132+
```
133+
This will create the `mxcd` directory and clone the repository `api-template` into it.
134+
#### Cloning from a subdirectory
135+
```
136+
$ pwd
137+
/home/user/github.com/mxcd
138+
$ gitclone api-template
139+
```
140+
This will clone the repository `api-template` from `mxcd/api-template` into the current directory since you already are in the `mxcd` directory.
141+
142+
#### Cloning from within nested subdirectories
143+
```
144+
$ pwd
145+
/home/user/gitlab.com/some/nested/group
146+
$ gitclone subgroup/my-repo
147+
```
148+
This will clone the repository `my-repo` from `gitlab.com/some/nested/group/subgroup/my-repo` into the `./subgroup/my-repo` directory.
55149

56-
### Examples
150+
## License
151+
Licensed under MIT License
152+
Copyright (c) 2022 Max Partenfelder

0 commit comments

Comments
 (0)