I was following GitLab’s official guide on connecting via SSH so that I don’t have to put in my password every time I access the remote server.
While I was following the guide, I made sure to add the same public key to our self-hosted instance and to gitlab.com.
When I tried to test the connection on gitlab.com:
$ ssh -T git@gitlab.com
Welcome to GitLab, @myusername!
However when I tried to test the connection on our instance:
$ ssh -T git@gitlab.ourdomain.com
Password:
I can’t figure out why it doesn’t work on our self-hosted instance of GitLab - setting up SSH is usually pretty straightforward for me but not this one.
Logs for gitlab.ourdomain.com
I tried to log what was happening and I got this at the end:
debug1: Next authentication method: publickey
debug1: Offering public key: RSA SHA256:CG1uQXxg/P8Zz+PcIjV90aXUw8Y1GsxtvELRtGSk+kM /h/.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,gssapi-keyex,gssapi-with-mic,password,keyboard-interactive
debug1: Trying private key: /h/.ssh/id_dsa
debug3: no such identity: /h/.ssh/id_dsa: No such file or directory
debug1: Trying private key: /h/.ssh/id_ecdsa
debug3: no such identity: /h/.ssh/id_ecdsa: No such file or directory
debug1: Trying private key: /h/.ssh/id_ed25519
debug3: no such identity: /h/.ssh/id_ed25519: No such file or directory
debug1: Trying private key: /h/.ssh/id_xmss
debug3: no such identity: /h/.ssh/id_xmss: No such file or directory
debug2: we did not send a packet, disable method
debug3: authmethod_lookup keyboard-interactive
debug3: remaining preferred: password
debug3: authmethod_is_enabled keyboard-interactive
debug1: Next authentication method: keyboard-interactive
debug2: userauth_kbdint
debug3: send packet: type 50
debug2: we sent a keyboard-interactive packet, wait for reply
debug3: receive packet: type 60
debug2: input_userauth_info_req
debug2: input_userauth_info_req: num_prompts 1
Password:
Logs for gitlab.com
debug1: Offering public key: RSA SHA256:CG1uQXxg/P8Zz+PcIjV90aXUw8Y1GsxtvELRtGSk+kM /h/.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 60
debug1: Server accepts key: pkalg rsa-sha2-512 blen 535
debug2: input_userauth_pk_ok: fp SHA256:CG1uQXxg/P8Zz+PcIjV90aXUw8Y1GsxtvELRtGSk+kM
debug3: sign_and_send_pubkey: RSA SHA256:CG1uQXxg/P8Zz+PcIjV90aXUw8Y1GsxtvELRtGSk+kM
debug3: send packet: type 50
debug3: receive packet: type 52
debug1: Authentication succeeded (publickey).