SSH Server configuration in Gitea

#1

Hi all,

I just setup my own Gitea server (version 1.8). The setup in general was super easy and straight forward. But now I struggle a little bit with the SSH configuration. I would prefer to use the system SSH server, also to avoid ugly port numbers in the SSH URL.

This is how my app.ini looked like directly after the initial setup:

[server]
SSH_DOMAIN       = <git.my-domain.tld>
DOMAIN           = <git.my-domain.tld>
HTTP_PORT        = 3000
ROOT_URL         = https://<git.my-domail.tld>
DISABLE_SSH      = false
SSH_PORT         = 22
LFS_START_SERVER = true
LFS_CONTENT_PATH = /home/git/data/lfs
LFS_JWT_SECRET   = hdfhfsdfjshdjkh
OFFLINE_MODE     = false

but if I try to clone a repository git clone git@<git.my-domain.tld>:bjoern/repository.git I get this error:

Cloning into 'repository'...
ssh: connect to host git.my-domain.tld port 22046: Connection refused
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

I wonder where this port 22046 comes from. I can’t find it in any config file. No SSH server runs on this port, so it is obvious that it doesn’t work. If it would just connect on port 22 it would most likely work.

If I update the app.ini, change “SSH_PORT” to 22046 and add START_SSH_SERVER = false it works but of course then Gitea shows as repository URL something like git@<git.my-domain.tld>:22046/bjoern/repository.git which I would like to avoid.

Any idea why ssh request are always redirected to port 22046 and where this port number comes from?

0 Likes