[英]SSH into EC2 and can't execute git clone command
我已经进入了一个新的ec2实例,我正在为我们的生产环境设置,并试图从另一个我们用作开发框的ec2实例git clone
一个项目,但是我得到了以下错误。
$ git clone ubuntu@?.??.??.??6:/var/git/our-project.git our-project
Cloning into 'our-project'...
ssh: connect to host ?.??.??.??6 port 22: Connection timed out
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
我在生产框上创建了一个公钥/私钥对,以连接到开发框,并将公钥添加到开发框的authorized_keys
。 这是我在本地机器上使用的相同设置,它可以工作。
我还为开发箱配置了一个AWS安全组,其中添加了生产ec2s公共IP以允许端口22上的ssh入站连接。
可能问题是我不能ssh
到一台机器并从其中执行另一个ssh
,这实际上是git clone
命令正在做什么? 我也尝试了在这个答案中建议使用以下内容从本地计算机运行git clone命令,但正如您所看到的,这给了我相同的错误消息。
ssh ubuntu@5?.??.??.??8 'git clone ubuntu@?.??.??.??6:/var/git/our-project.git /var/www/our-project'
Cloning into '/var/www/houseofireland'...
ssh: connect to host ?.??.??.??6 port 22: Connection timed out
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
非常感谢此问题的任何可能原因或解决方案。
正如评论中所指出的,这不是一个git问题,而是ssh问题。
通常,可以从一个EC2实例SSH到另一个实例,但请记住以下内容:
你应该做的是将你在哪个SSH隧道的实例放在第二个实例的SecurityGroup中的白名单上(假设它们在同一个帐户上)。
希望这可以帮助
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.