EC2无法SSH进入github [英] EC2 can't SSH into github

查看:82
本文介绍了EC2无法SSH进入github的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

进入网站... 权限被拒绝(公钥). 致命:远端意外挂起

Cloning into website... Permission denied (publickey). fatal: The remote end hung up unexpectedly

即使我已生成SSH密钥并将SSH密钥添加到Github上允许的密钥上,也可以在我的EC2实例上不断获得此密钥.

Constantly getting this on my EC2 instance, even though I have generated an SSH key and added the SSH key to the allowed keys on Github.

当我测试身份验证时,我得到了:

When I test authentication I get this:

输入密钥'/home/ec2-user/.ssh/id_rsa'的密码: DaveHewy!您已成功通过身份验证,但是GitHub不提供shell访问.

Enter passphrase for key '/home/ec2-user/.ssh/id_rsa': Hi DaveHewy! You've successfully authenticated, but GitHub does not provide shell access.

但是当我尝试克隆存储库时,就没有运气了.

But when I try and clone a repo, no such luck.

推荐答案

您应该考虑使用代理转发,而不是处理多个密钥并将ssh github密钥放置在EC2实例上.那改变了我的部署方式.

Instead of handling several keys and keeping ssh github keys laying around on your EC2 instance you should consider using Agent Forwarding instead. That changed the way I deploy.

https://help.github.com/articles/using-ssh-代理转发

通过代理转发,您实质上是在登录EC2实例时使用本地密钥.如果其他人登录到该实例,则他们将无法拉/推回购协议.

With Agent Forwarding you are essentially using your local keys while logged into the EC2 instance. If someone else logs into the instance they won't be able to pull/push the repo if they have no access to it.

简单,干净,安全.

您必须在远程主机上拥有SSH密钥的唯一很好的原因是要进行持续集成或自动进行部署.在这种情况下,您应该使用部署密钥.使用部署密钥,您只能拉动.

The only good reason you have to have SSH keys on a remote host is to have continuous integration or automating deployments. In that case you should use a deploy key. Using the deploy key you can only pull.

这篇关于EC2无法SSH进入github的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆