You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/content/doc/installation/with-docker.en-us.md
+11-7Lines changed: 11 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -345,19 +345,23 @@ ports:
345
345
- "127.0.0.1:2222:22"
346
346
```
347
347
348
-
In addition, `/home/git/.ssh/authorized_keys` on the host needs to be modified. It needs to act in the same way as `authorized_keys` within the Gitea container. Therefore add
348
+
In addition, `/home/git/.ssh/authorized_keys` on the host needs to be modified. It needs to act in the same way as `authorized_keys` within the Gitea container. Therefore add the public key of the key you created above ("Gitea Host Key") to `~/git/.ssh/authorized_keys`.
349
+
This can be done via `echo "$(cat /home/git/.ssh/id_rsa.pub)" >> /home/git/.ssh/authorized_keys`.
350
+
Important: The pubkey from the `git` user needs to be added "as is" while all other pubkeys added via the Gitea web interface will be prefixed with `command="/app [...]`.
and replace `<YOUR_SSH_PUBKEY>` with a valid SSH public key of yours.
354
+
```bash
355
+
# SSH pubkey from git user
356
+
ssh-rsa <Gitea Host Key>
355
357
356
-
In addition the public key of the `git` user on the host needs to be added to `/home/git/.ssh/authorized_keys` so authentication against the container can succeed: `echo "$(cat /home/git/.ssh/id_rsa.pub)" >> /home/git/.ssh/authorized_keys`.
Here is a detailed explanation what is happening when a SSH request is made:
359
363
360
-
1. A SSH request is made against the host using the `git` user, e.g. `git clone git@domain:user/repo.git`.
364
+
1. A SSH request is made against the host (usually port 22) using the `git` user, e.g. `git clone git@domain:user/repo.git`.
361
365
2. In `/home/git/.ssh/authorized_keys` , the command executes the `/app/gitea/gitea` script.
362
366
3.`/app/gitea/gitea` forwards the SSH request to port 2222 which is mapped to the SSH port (22) of the container.
363
367
4. Due to the existence of the public key of the `git` user in `/home/git/.ssh/authorized_keys` the authentication host → container succeeds and the SSH request get forwarded to Gitea running in the docker container.
0 commit comments