Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clone via ssh fails with "kex_exchange_identification: Connection closed by remote host" #9

Open
jki21 opened this issue May 28, 2020 · 0 comments

Comments

@jki21
Copy link

jki21 commented May 28, 2020

I've modified gitea-persistent-template.yaml to create gitea with SSH port opened:

    # Add 2022 port under Service -> spec -> ports
    - name: 2022-tcp
      port: 2022
      protocol: TCP
      targetPort: 2022

    # Add 2022 port under DeploymentConfig -> template -> spec -> ports
          - containerPort: 2022
            protocol: TCP
            name: ssh

HTTP cloning works fine but follow error shows when try to clone with SSH:

$ git clone ssh://gitea@myhostname:2022/user1/test-repo.git
Cloning into 'test-repo' ...
kex_exchange_identification: Connection closed by remote host

Logs when troubleshoot with ssh -vvvT gitea@myhostname -p 2022:

debug1: Connecting to myhostname [::1] port 2022.
debug1: Connection established.
...
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug3: send packet: type 50
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey
debug3: start over, passed a different list publickey
debug3: preferred gssapi-keyex,gssapi-with-mic,publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/user1/.ssh/id_rsa
debug3: send_pubkey_test
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey
debug1: Trying private key: /home/user1/.ssh/id_dsa
debug3: no such identity: /home/user1/.ssh/id_dsa: No such file or directory
debug1: Trying private key: /home/user1/.ssh/id_ecdsa
debug3: no such identity: /home/user1/.ssh/id_ecdsa: No such file or directory
debug1: Trying private key: /home/user1/.ssh/id_ed25519
debug3: no such identity: /home/user1/.ssh/id_ed25519: No such file or directory
debug2: we did not send a packet, disable method
debug1: No more authentication methods to try.
Permission denied (publickey).

According to this post, it seems to relate to folder permission issues. Which I checked to be true in the gitea pod:

sh-4.4$ ls -al /home
total 0
drwxr-xr-x. 1 root root 19 May 11 14:03 .
drwxr-xr-x. 1 root root 40 May 27 08:32 ..
drwxrwx---. 1 1000 root 47 May 27 08:32 gitea
sh-4.4$ id
uid=1001(gitea) gid=0(root) groups=0(root)
sh-4.4$ 

It seems that gitea has uid of 1001 but /home/gitea is owned by 1000. Is this a bug or am I missing something?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant