弹性beanstalk访问私人git回购

我正在尝试使用.ebextensions命令为我的弹性beanstalk实例添加一个ssh密钥。

我存储的密钥在我的应用程序代码中,我尝试将它们复制到根.ssh文件夹,以便以后在执行git + ssh克隆时可以访问它们

这里是我的.ebextensions文件夹中的configuration文件的一个例子

packages: yum: git: [] container_commands: 01-move-ssh-keys: command: "cp .ssh/* ~root/.ssh/; chmod 400 ~root/.ssh/tca_read_rsa; chmod 400 ~root/.ssh/tca_read_rsa.pub; chmod 644 ~root/.ssh/known_hosts;" 02-add-ssh-keys: command: "ssh-add ~root/.ssh/tca_read_rsa" 

问题是我试图克隆回购时得到的是一个错误

 Host key verification failed. 

我尝试了很多方法尝试将主机添加到known_hosts文件,但没有任何工作!

执行克隆的命令是npm install,因为repo指向节点模块

    我把这个添加到我的ebextensions中。 这是我曾经连接到代码提交。 我需要指定用户并忽略主机密钥检查。 希望这可以帮助任何人阻止…

     commands: add_ssh_config: command: printf "Host git-codecommit.*.amazonaws.com\r\n StrictHostKeyChecking no\r\n User <name-of-user>\r\n IdentityFile ~/.ssh/<name-of-key>.pem" > /home/ec2-user/.ssh/config"