【问题标题】:connect ssh to google virtual instanse always got Permission denied (publickey)将 ssh 连接到谷歌虚拟实例总是被拒绝权限(公钥)
【发布时间】:2020-05-23 00:47:40
【问题描述】:

我跑cat ~/.ssh/id_rsa.pub 并将ssh-rsa AAAA...hwFbh me@me.local复制到谷歌云上的SSH Keys VM实例中,然后保存 然后我尝试在我的终端上登录:

ssh my-project@ip-address

然后得到 Permission denied (publickey)

我认为我以正确的方式将 ssh 密钥放入我的 VM 实例,我从未成功使用我的 ssh 到谷歌云,但在 AWS 和数字海洋上总是没有问题,

如果我使用glcoud

gcloud compute ssh --zone "us-central1-f" "my-project" --project "my-project-277520"

它已成功登录到我的虚拟机实例

为什么我要使用命令ssh my-project@ip-address 登录 因为如果我无法使用此命令访问,我的 git 服务器上会出现错误,它会抛出相同的东西 Permission denied (publickey)

fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

对于那个 VM 实例上的 git 挂钩,我不能这样做 git push production master 我在该服务器上使用 git hooks

这件事怎么解决?这几天我真的被困住了:(当然我一直在看 StackOverflow 并在谷歌上搜索解决这个问题,但我最终需要在这里为你寻求帮助

【问题讨论】:

  • ssh -Tv my-project@ip-address 的输出是什么?请edit加长文。

标签: git ssh google-cloud-platform virtual-machine google-compute-engine


【解决方案1】:

ssh-rsa AAAA...hwFbh me@me.local复制到谷歌云上的SSH Keys VM实例中,然后保存

这取决于你是如何复制的(因为you cannot directly add it to the remote ~/.ssh/authorized_keys

例如:“Adding or removing project-wide public SSH keys

确保它被复制为一个连续线。

然后检查您的本地权限(密钥为 600)

【讨论】:

    猜你喜欢
    • 2019-01-07
    • 1970-01-01
    • 1970-01-01
    • 2020-02-11
    • 2019-11-24
    • 2014-11-08
    • 2019-03-11
    • 1970-01-01
    • 2014-06-17
    相关资源
    最近更新 更多