docs: clarify oauth2 requirement and read/write

Addresses feedback that oauth2 is not required, and that the token
itself can serve as the username. Clarifies that read access is all that
is required for fetching.
This commit is contained in:
Mark Pitblado 2025-02-03 06:31:38 -08:00 committed by Robert Wolff
parent 0e14351c66
commit e7fe2eee03
No known key found for this signature in database
GPG key ID: 1614C70AD69A61A1

View file

@ -19,7 +19,7 @@ Clone with the Git command `clone` followed by the repo URL.
### SSH
SSH is the recommended method to use to access your online repository. Before you are able to access Git repositories via SSH, you need to [add an SSH key to your account](/security/ssh-key).
Before you are able to access Git repositories via SSH, you need to [add an SSH key to your account](/security/ssh-key).
{% admonition "warning" %}
@ -52,10 +52,10 @@ 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`. You only need to scope the access token to have read/write access to repositories for this operation.
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 wish to fetch repositories, the token only needs read access. If you wish to push to the repository and have 2FA enabled, write access is needed.
```shell
~$ git clone https://oauth2:token@codeberg.org/user/repo.git
~$ git clone https://token@codeberg.org/user/repo.git
Cloning into 'repo'...
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.