这是我的设置。
当我登录到我的远程服务器并在我的git存储库上运行“git pull”时,一切正常。 此处没有问题。
但是当我通过windows上的cygwin bash运行相同的内容时,它会给我这个错误:
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
我在Windows机器上执行以下操作
ssh -i xyz.pem user@ip -t 'sudo sh deploy.sh'
将“deploy.sh”, cd 放入我的存储库并执行git pull
。
为什么会出现这个问题? 我是否应该将这些ssh密钥保存在我的Windows机器上? 任何帮助都是非常宝贵的。
答案 0 :(得分:0)
我在'sudo sh deploy.sh'中使用“sudo”,这促使它检查root用户.ssh文件夹中的信用。删除“sudo”,它工作正常。