add instructions for how to clone a private repository from the command line (#848)

Rebased and fixed version of !459

Co-authored-by: Mark Pitblado <mark@pitblado.me>
Reviewed-on: https://codeberg.org/Codeberg/Documentation/pulls/848
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
This commit is contained in:
Robert Wolff 2026-07-17 16:25:54 +02:00
parent 246a9e43de
commit 13db526474

View file

@ -18,18 +18,7 @@ The repository was created via the Codeberg website, including a `README.md` fil
### Clone
_Cloning_ refers to the process of creating an identical copy of an online repository to your local machine.
Clone with the Git command `clone` followed by the repo URL.
#### HTTP
```shell
~$ git clone https://codeberg.org/knut/examples.git
Cloning into 'examples'...
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), 214 bytes | 1024 bytes/s, done.
```
It is performed using the Git command `git clone` followed by the [SSH](#ssh) or the [HTTP](#http) repository URL.
#### SSH
@ -55,6 +44,28 @@ remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
```
#### HTTP
```shell
~$ git clone https://codeberg.org/knut/examples.git
Cloning into 'examples'...
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), 214 bytes | 1024 bytes/s, done.
```
If you wish to clone a private repository, simply add an [access token](/advanced/access-token/) from your account into the URL passed to `git clone`. If you only want to clone or fetch from the repository, the token only needs read access. If you want to push to the repository, write access is needed.
```shell
~$ git clone https://token@codeberg.org/knut/examples.git
Cloning into 'examples'...
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), 214 bytes | 1024 bytes/s, done.
```
### Edit
Modify an existing file: