13
5

More than 1 year has passed since last update.

AWS CodeCommit にSSHでgit接続できないやんけ問題

Last updated at Posted at 2021-10-27

💣問題

超絶ドザなのでWindowsに git 2.33.1 をインストールしている。
AWS CodeCommit から SSH で Cloneしようとすると、何か怒られるではないか。

Unable to negotiate with 52.12.34.56 port 22: no matching host key type found.
Their offer: ssh-rsa
fatal: Cloud not read from remote repository.

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

ばかなと思ってみんな大好き亀さんで試すと普通にCloneできた。ばかな。

😇対処

~/.ssh/config を以下の感じにしよう

Host git-codecommit.*.amazonaws.com
    User hogehogemoge
    IdentityFile ~/.ssh/id_rsa
    HostKeyAlgorithms +ssh-rsa
    PubkeyAcceptedKeyTypes +ssh-rsa

最後の2行がAWSの取説に従った状態から追加した部分だ。

OpenSSH8.5で PubkeyAcceptedKeyTypesPubkeyAcceptedAlgorithmsにリネームされているが、新しい名前にすると古いOpenSSHにbad configuration optionsと怒られるのであった。
2021年10月時点ではGit付属のGit bashとVS Codeで使われるOpenSSHが別物な時に困ることになる。

🐋原因

OpenSSH 8.8からssh-rsa公開鍵署名アルゴリズムは無効化されてしまったが、AWS側はssh-rsaにせよと言ってくるためだ。
https://www.openssh.com/txt/release-8.8

OpenSSH 8.3が内蔵されたのは v2.33.1 から
https://github.com/git-for-windows/git/releases/tag/v2.33.1.windows.1

今回と同じ問題を踏んだ方のIssue
https://github.com/git-for-windows/git/issues/3468

タイムリーすぎる。AWS側が変な気がするからなんか対応されないかなあ。

13
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
13
5