[英]push to remote git repository on ubuntu server - Permission denied (publickey)
我在Windows机器上尝试将代码推送到运行ubuntu的ec2实例上的远程git存储库。 我已经设置了实例,并在实例上的某个位置创建了一个裸仓库。
我在实例cos上有我的公钥,我可以通过腻子以及我安装的openssh软件将它SSH到它。
我签了
git push heroku master权限被拒绝(公钥)
但是建议的解决方案我不清楚
我可以使用ssh -i mykey.pem ubuntu@1.1.1.1进入实例。
问题是我已将存储库添加到我的遥控器列表中,但是当我尝试使用以下方法从本地主服务器推送到远程存储库时,仍然出现以下错误
production - ssh://ubuntu@ec2-1-1-1-1.compute-1.amazonaws.com
git push production master
错误
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
我可以使用ssh -i mykey.pem ubuntu@1.1.1.1进入实例。
这就是问题所在–您将mykey.pem
用于ssh,但是git使用默认密钥。 您必须配置ssh
以便mykey.pem
是该主机的默认密钥:
# .ssh/config
Host ec2-1-1-1-1.compute-1.amazonaws.com
User ubuntu
IdentityFile mykey.pem
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.