Add git http protocol

This commit is contained in:
Jose Gracia 2024-05-15 13:38:26 +02:00
parent b36a8ecd7e
commit 779b5bb34f

View file

@ -95,12 +95,43 @@ Git essentially supports two [protocols](https://git-scm.com/book/en/v2/Git-on-t
Both protocols can routed through a SOCKS5 proxy. Both protocols can routed through a SOCKS5 proxy.
Two protocols: https and ssh ==**TODO: do we recommend one over the other?**==
Push works with https protocol as well, see below.
### git https protocol ### git https protocol
Requirements:
- set up a proxy with ssh as describe in [this section](#setting-up-a-proxy-with-ssh)
- set https proxy variables as describe in [this section](#httpshttp-proxy-variables)
The https protocol is mostly used to clone public git repositories for read-only access (without the intension to push changes upstream). In these cases, git does not use any kind of authentication. However, git can also use authentication through the https protocol.
In the simplest case, cloning public repositories without authentication just requires setting up the SOCKS5 proxy and defining the https/http proxy environment variables as explained above. Then just clone with
```bash
# set up proxy with ssh and continue in the terminal which just opened
# set https/http proxy environment variables as describe above, then
hawk> git clone https://github.com:user/project.git
hawk> git pull
```
To access remote repositories with authentication, we recommend using _access tokens_. These access tokens are supported my most repositories. Follow the links to the respective documentation: [github](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens), gitlab, [gitea](https://docs.codeberg.org/advanced/access-token/), etc.
We recommend to set up dedicated access tokens for access from Hawk. Then work on the repository with
```bash
# set up proxy with ssh and continue in the terminal which just opened
# set https/http proxy environment variables as describe above, then
# set up access tokens for repository
hawk> git clone https://github.com:user/project.git
# enter user name
# enter access token as password
hawk> git fetch
hawk> git pull
hawk> git push
```
Any of these commands may ask you for credentials such as username and password. Enter your access code when prompted for the password. You may consider [managing credentials in git](https://git-scm.com/docs/gitcredentials).
### Git with ssh protocol ### Git with ssh protocol
@ -136,5 +167,7 @@ git fetch
git pull git pull
git push git push
``` ```
Any of these commands my ask you for credentials to unlock the ssh public key.
Again, we recommend to keep the reverse tunnel open as briefly as possible. Again, we recommend to keep the reverse tunnel open as briefly as possible.