Skip to content

Commit 48703c3

Browse files
updated docs with caveat for authorized_keys (#13030)
* updated docs with caveat for authorized_keys * wrapped authorized_keys in ticks Co-authored-by: techknowlogick <techknowlogick@gitea.io>
1 parent 01c7204 commit 48703c3

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

docs/content/doc/installation/with-docker.en-us.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,9 @@ Your `git` user needs to have an SSH key generated:
341341
sudo -u git ssh-keygen -t rsa -b 4096 -C "Gitea Host Key"
342342
```
343343

344-
Still on the host, symlink the container `.ssh/authorized_keys` file to your git user `.ssh/authorized_keys`.
344+
Now, proceed with one of the points given below:
345+
346+
- symlink the container `.ssh/authorized_keys` file to your git user `.ssh/authorized_keys`.
345347
This can be done on the host as the `/var/lib/gitea` directory is mounted inside the container under `/data`:
346348

347349
```
@@ -354,6 +356,23 @@ Then echo the `git` user SSH key into the authorized_keys file so the host can t
354356
echo "no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty $(cat /home/git/.ssh/id_rsa.pub)" >> /var/lib/gitea/git/.ssh/authorized_keys
355357
```
356358

359+
Lastly, Gitea makes `authorized_keys` backups by default. This could be a problem
360+
as the symbolic link made to `authorized_keys` previously could end up pointing
361+
to an old backup. To resolve this, please put the following into your Gitea
362+
config:
363+
364+
```
365+
[ssh]
366+
SSH_BACKUP_AUTHORIZED_KEYS=false
367+
```
368+
369+
- mount your `.ssh` directory directly into the container i.e. add the
370+
following to the `volumes` section of your Docker container config:
371+
372+
```
373+
- /home/git/.ssh/:/data/git/.ssh/
374+
```
375+
357376
Now you should be able to use Git over SSH to your container without disrupting SSH access to the host.
358377

359378
Please note: SSH container passthrough will work only if using opensshd in container, and will not work if

0 commit comments

Comments
 (0)