【发布时间】: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