---
# System prepended metadata

title: AWS codecommit SSH連線設定
tags: [codecommit, ssh, aws]

---


# AWS codecommit SSH連線設定

###### tags: `aws`,`codecommit`,`ssh`

前言:

嘗試要從aws codecommit clone有權限的repo，
依照aws的tutorial在iam下設定ssh key與本機~/.ssh/下設置config檔後

>ref: https://docs.aws.amazon.com/zh_tw/codecommit/latest/userguide/setting-up-ssh-windows.html#setting-up-ssh-windows-keys-windows

在cmd下使用
> <p>ssh git-codecommit.us-east-2.amazonaws.com</p>
得到成功response
![](https://i.imgur.com/s1cQvqY.png)

在git clone <aws-codecommit-repo-ssh url> 下卻得到連線錯誤
>Unable to negotiate with 54.240.225.207 port 22: no matching host key type found. Their offer: ssh-rsa
>
    
用錯誤訊息google個看起來cloud都有類似問題 
    
Azure devop:
https://stackoverflow.com/questions/69875520/unable-to-negotiate-with-40-74-28-9-port-22-no-matching-host-key-type-found-th/69875803#69875803?newreg=cbf40ed0f5964256bf9e406e5a0188a7

linux openSSH:
https://dev.to/cloudx/why-openssh-8-8-cannot-find-a-host-key-type-if-ssh-rsa-is-provided-49i

結果似乎是server端再進行解析時未支援RSA with SHA-256/RSA with SHA-512, 但window10 ssh agent 預設情況下因安全性問題棄用sha-1(ssh-rsa),需再.ssh/config下針對連線設置,就能成功git clone下來

> PubkeyAcceptedAlgorithms +ssh-rsa
  HostkeyAlgorithms +ssh-rsa

![](https://i.imgur.com/vrqtCHG.png)

不過在cloud修改前,大多還是建議用https的連線方式安全

 


    
    
    
