gitlabに接続できない場合に尋ねる前にするべきこと
確認
-vvv
オプションでデバッグできる
ssh -i <秘密鍵の場所> git@example.com -vvv
正常
$ ssh -i ~/.ssh/id_rsa git@git.example.com -vvv
OpenSSH_7.9p1, LibreSSL 2.7.3
debug1: Reading configuration data /path/to/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 48: Applying options for *
debug1: Connecting to example.com.
debug1: Connection established.
...
debug2: channel 0: is dead
debug2: channel 0: garbage collecting
debug1: channel 0: free: client-session, nchannels 1
debug3: channel 0: status: The following connections are open:
#0 client-session (t4 r0 i3/0 o3/0 e[write]/0 fd -1/-1/8 sock -1 cc -1)
debug3: send packet: type 1
debug3: fd 1 is not O_NONBLOCK
Connection to git.example.com closed.
Transferred: sent 3924, received 3484 bytes, in 0.0 seconds
Bytes per second: sent 82081.7, received 72877.9
debug1: Exit status 0
異常
OpenSSH_7.9p1, LibreSSL 2.7.3
debug1: Reading configuration data /path/to/.ssh/config
debug1: /path/to/.ssh/config line 1: Applying options for git.drecom.jp
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 48: Applying options for *
debug1: Connecting to git.example.com.
ssh: connect to host git.example.com: Operation timed out