【问题标题】:How do I use my SSH keys for Git on another remote server?如何在另一台远程服务器上使用我的 SSH 密钥进行 Git?
【发布时间】:2020-12-31 21:06:47
【问题描述】:

我在让 Git 在新设置的远程服务器上工作时遇到问题。实际服务器本身我已关闭密码身份验证并使用密钥身份验证。服务器使用的密钥与我用于 git 的密钥相同。

我在本地机器上使用ssh-copy-id user@4xx.xx.xx.xx 将密钥添加到服务器,然后在远程机器上使用sudo chmod -R 700 ~/.ssh && chmod 600 ~/.ssh/authorized_keys

现在到 git。我正在尝试从远程服务器运行git clone git@github.com:user/some-repo.git 并获取以下日志:

Warning: Permanently added the RSA host key for IP address 'xx.xxx.xx.xx' to the list of known hosts.
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights

如何让它工作?私钥是否也需要复制到这台机器上?我该怎么做?

任何指针将不胜感激。谢谢!

【问题讨论】:

  • 不清楚您是从哪台机器上运行 git。你是说你从本地机器 ssh 到远程服务器,然后在你试图运行 git 的远程服务器上?
  • 对不起。从远程。编辑了问题

标签: linux ssh ssh-keys


【解决方案1】:

对于您的情况,生成一个新的 ssh 密钥是正确的,使用ssh-keygen 流和add into your Git account 作为新的访问密钥。

【讨论】:

  • 哦该死的。没想到这个忘了我可以拥有不止一把钥匙。这是最有意义的。谢谢
猜你喜欢
  • 2021-03-21
  • 2023-02-06
  • 2013-09-12
  • 2017-11-06
  • 1970-01-01
  • 2013-06-28
  • 2017-12-29
  • 2012-11-26
  • 1970-01-01
相关资源
最近更新 更多