[英]push to remote git repository on ubuntu server - Permission denied (publickey)
I am on a windows machine trying to push code up to a remote git repository on an ec2 instance which runs ubuntu. 我在Windows机器上尝试将代码推送到运行ubuntu的ec2实例上的远程git存储库。 I have setup the instance and created a bare repo at a location on the instance. 我已经设置了实例,并在实例上的某个位置创建了一个裸仓库。
I have my public key on the instance cos i can ssh to it via putty and also via openssh software i installed. 我在实例cos上有我的公钥,我可以通过腻子以及我安装的openssh软件将它SSH到它。
i checked out 我签了
https://serverfault.com/questions/39733/why-do-i-get-permission-denied-publickey-when-trying-to-ssh-from-local-ubunt https://serverfault.com/questions/39733/why-do-i-get-permission-denied-publickey-when-trying-to-ssh-from-local-ubunt
git push heroku master Permission denied (publickey) git push heroku master权限被拒绝(公钥)
Git - Permission denied (publickey) Git-权限被拒绝(公钥)
but the suggested solutions were not clear to me 但是建议的解决方案我不清楚
I can ssh into the instance using ssh -i mykey.pem ubuntu@1.1.1.1. 我可以使用ssh -i mykey.pem ubuntu@1.1.1.1进入实例。
Problem is i have added the repo to my list of remotes but i keep getting the following error when i try to push from my local master to the remote repo using 问题是我已将存储库添加到我的遥控器列表中,但是当我尝试使用以下方法从本地主服务器推送到远程存储库时,仍然出现以下错误
production - ssh://ubuntu@ec2-1-1-1-1.compute-1.amazonaws.com
git push production master
Error 错误
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I can ssh into the instance using ssh -i mykey.pem ubuntu@1.1.1.1. 我可以使用ssh -i mykey.pem ubuntu@1.1.1.1进入实例。
This is the problem — you use mykey.pem
for ssh but git uses default key. 这就是问题所在–您将mykey.pem
用于ssh,但是git使用默认密钥。 You have to configure ssh
so that mykey.pem
is the default key for that host: 您必须配置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.