dockerで動作中のGitLabにキー認証でSSH接続しようとしたらパスワードを聞かれる。
ここを参考に作業させていただきました。
原因
正しいportを指定できていなかった
Host gitlab
User git
HostName 192.168.xxx.xxx
TCPKeepAlive yes
identitiesonly yes
identityFile ~/.ssh/id_rsa
最初はこのように設定していました。
正しくはPortを10022にしてあげること()
Host gitlab
User git
Port 10022
HostName 192.168.xxx.xxx
TCPKeepAlive yes
identitiesonly yes
identityFile ~/.ssh/id_rsa
なぜport10022?
GitLabを建てる際に書いたdocker-compose.ymlを見てみると
gitlab:
restart: always
image: sameersbn/gitlab:11.9.5
depends_on:
- redis
- postgresql
ports:
- "80:80"
- "10022:22" ←ここ
10022:22と書いてあります…
サーバー側の10022portがGitLab側の22portになっているわけです。
結局キーの登録などは間違っておらず、接続しに行く場所が悪かったという…