# SSH Server configuration in Gitea

**URL:** <https://forum.gitea.com/t/ssh-server-configuration-in-gitea/1058>\
**Category:** Install/Maintain/Configure\
**Created:** [April 4, 2019, 8:28pm UTC](https://forum.gitea.com/t/ssh-server-configuration-in-gitea/1058 "2019-04-04T20:28:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bjoern](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/bjoern/32/4816_2.png) [@bjoern](https://forum.gitea.com/u/bjoern)\
**Post date:** [April 4, 2019, 8:28pm UTC](https://forum.gitea.com/t/ssh-server-configuration-in-gitea/1058/1 "2019-04-04T20:28:17Z")

</div>

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:

```auto
[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:

```auto
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?

---

<div class="post-metadata">

**Author:** ![rpcm](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/rpcm/32/4381_2.png) [@rpcm](https://forum.gitea.com/u/rpcm)\
**Post date:** [February 8, 2024, 9:51pm UTC](https://forum.gitea.com/t/ssh-server-configuration-in-gitea/1058/2 "2024-02-08T21:51:03Z")

</div>

Is it possible your `/etc/ssh/sshd_config` is specifying Port `22046`?
