# Cant connect to Getia via SSH (git clone\\push)

**URL:** <https://forum.gitea.com/t/cant-connect-to-getia-via-ssh-git-clone-push/7848>\
**Category:** Install/Maintain/Configure\
**Created:** [September 17, 2023, 2:38pm UTC](https://forum.gitea.com/t/cant-connect-to-getia-via-ssh-git-clone-push/7848 "2023-09-17T14:38:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alexey](https://avatars.discourse-cdn.com/v4/letter/a/47e85d/32.png) [@Alexey](https://forum.gitea.com/u/Alexey)\
**Post date:** [September 17, 2023, 2:38pm UTC](https://forum.gitea.com/t/cant-connect-to-getia-via-ssh-git-clone-push/7848/1 "2023-09-17T14:38:35Z")

</div>

Hello!  
I saw a lot of topics related to ssh but not a single advice helped.  
**My problem is: i can’t connect to server via ssh, so can’t clone\push git repo.**  
My setup of Getia:

1. Proxmox LX container. Local network with full access: 192.168.33.41
2. my server hostname: giteahome.local; my ip: 192.168.33.41  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/gitea/original/2X/7/7aad39bf93ed409e8661ad27950f5b3b386d3f6b.png)
3. My config

```auto
[server]
PROTOCOL=https
REDIRECT_OTHER_PORT=true
CERT_FILE = /etc/gitea/cert.pem
KEY_FILE = /etc/gitea/key.pem
SSH_DOMAIN = giteahome.local
DOMAIN = giteahome.local
HTTP_PORT = 443
ROOT_URL = https://giteahome.local/
APP_DATA_PATH = /var/lib/gitea/data
DISABLE_SSH = false
SSH_PORT = 22
LFS_START_SERVER = true
LFS_JWT_SECRET = _ft6y02cCPMpAesXVZEpdvRJ41N0y49EyZLtLPO17Pc
OFFLINE_MODE = false

```

I use 443 port with self signed cert:

```auto
#Cd to the gitea directory
cd /etc/gitea
#sign cert
gitea cert --host giteahome.local
#Give gitea user read permissions
chown root:gitea cert.pem key.pem
chmod 640 cert.pem key.pem
#Restart gitea
systemctl restart gitea

```

There is no port redirection or anything else, i use 22 port for ssh.

1. All work perfectly wia https

```auto
git -c http.sslVerify=false https://giteahome.local/alexeygrishchenko/testrepo.git

```

But is still don’t wok with SSH.  
My steps are:

1. Windows 10 client + VSCode
2. Go to console

```auto
ssh-keygen

```

I try different names and type of RSA keys - there is no result.  
3. My setup on config file for git:

```auto
Host giteahome.local
HostName giteahome.local
User gitea
Port 22
PreferredAuthentications publickey
PasswordAuthentication no
# CMD
IdentityFile C:\Users\Admin\.ssh\gitea_rsa_key
# BASH
IdentityFile /c/Users/Admin/.ssh/gitea_rsa_key

```

I also try ip instead of DNS name, no result.

```auto
PS C:\Users\Admin\Desktop\git_test\testgitea\testrepo2> ssh -T gitea@192.168.33.41
The authenticity of host '192.168.33.41 (192.168.33.41)' can't be established.
ECDSA key fingerprint is SHA256:rVsHVLd3NRBGy4YjVhc1knRiCP1UdFrXZeBeAT/o7lQ.  
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '192.168.33.41' (ECDSA) to the list of known hosts.
gitea@192.168.33.41's password: 
PS C:\Users\Admin\Desktop\git_test\testgitea\testrepo2> ssh -T gitea@giteahome.local
The authenticity of host 'giteahome.local (192.168.33.41)' can't be established.
ECDSA key fingerprint is SHA256:rVsHVLd3NRBGy4YjVhc1knRiCP1UdFrXZeBeAT/o7lQ.    
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'giteahome.local' (ECDSA) to the list of known hosts.
no such identity: /c/Users/Admin/.ssh/gitea_rsa_key: No such file or directory
gitea@giteahome.local: Permission denied (publickey,password).
PS C:\Users\Admin\Desktop\git_test\testgitea\testrepo2> history

```

My local known\_hosts file after try to SSH looks like nornal:  
**giteahome.local,192.168.33.41 ecdsa-sha2-nistp256 AAAAE2VjZH…**

Then i try git clone

```auto
PS C:\Users\Admin\Desktop\git_test\testgitea\testrepo2> git clone ssh://gitea@giteahome.local/alexeygrishchenko/testrepo.git 
Cloning into 'testrepo'...
gitea@giteahome.local: Permission denied (publickey,password).
fatal: Could not read from remote repository.      

Please make sure you have the correct access rights
and the repository exists.
PS C:\Users\Admin\Desktop\git_test\testgitea\testrepo2> git clone ssh://gitea@giteahome.local:443/alexeygrishchenko/testrepo.git
Cloning into 'testrepo'...
kex_exchange_identification: Connection closed by remote host
Connection closed by 192.168.33.41 port 443        
fatal: Could not read from remote repository.      

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

```

I know issue with this:  
Wrong:  
**git clone gitea@giteahome.local:alexeygrishchenko/testrepo.git**

Correct:  
**git clone ssh://gitea@giteahome.local/alexeygrishchenko/testrepo.git**

I also try with port 443  
**git clone ssh://gitea@giteahome.local:443/alexeygrishchenko/testrepo.git**  
and with Ip - no result

```auto
PS C:\Users\Admin\Desktop\git_test\testgitea\testrepo2> git clone ssh://gitea@giteahome.local/alexeygrishchenko/testrepo.git 
Cloning into 'testrepo'...
gitea@giteahome.local: Permission denied (publickey,password).
fatal: Could not read from remote repository.      

Please make sure you have the correct access rights
and the repository exists.
PS C:\Users\Admin\Desktop\git_test\testgitea\testrepo2> git clone ssh://gitea@giteahome.local:443/alexeygrishchenko/testrepo.git
Cloning into 'testrepo'...
kex_exchange_identification: Connection closed by remote host
Connection closed by 192.168.33.41 port 443        
fatal: Could not read from remote repository.      

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

```

I try to add the gitea user to the **AllowUsers in /etc/ssh/sshd\_config** in my container - no result.

Can someone tell me what is wrong???
