在EC2服务器上使用SSH密钥从Bitbucket.org Git克隆

我们已经build立了一个EC2构build服务器,并希望使用SSH密钥克隆回购。

采取的步骤:

cd ~/.ssh ssh-keygen -t rsa 

创build的configuration:

 host bitbucket.org HostName bitbucket.org IdentityFile ~/.ssh/bitbucket_rsa User git 

位桶上加载公共ssh密钥:

ssh-rsa … key … ec2_user @ ip-censored

什么时候:

 git clone https://[email protected]/user/repo.git 

它要求input密码。 我们应该检查或做的事情,看看我们要去哪里错了?

如果要使用公钥authentication,则无法通过HTTPS进行克隆。 你需要修改到SSH的URL,像这样:

 git clone [email protected]/user/repo.git 

要么

 git clone ssh://[email protected]/user/repo.git 

应该为你工作 。

看来你做的一切都是正确的。 问题可能是你提供的ssh参数。 这是我的configuration工作:

 Host bitbucket.org IdentityFile ~/.ssh/bitbucket.pem IdentitiesOnly yes StrictHostKeyChecking no 

我认为StrictHostKeyChecking no可能是关键。