linux - 如何在另一台远程服务器上使用我的 SSH 密钥进行 Git?
问题描述
我在让 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
我怎样才能让它工作?私钥是否也需要复制到这台机器上?我该怎么做呢?
任何指针将不胜感激。谢谢!
解决方案
对于您的情况,生成新的 ssh 密钥、使用ssh-keygen流程并作为新的访问密钥添加到您的 Git 帐户中是正确的。
推荐阅读
- java - MockServer -> 返回自定义对象响应
- coq - 依赖类型启用的编程风格的名称是什么(想想 Coq 或 Agda)?
- javascript - How do I combine puppeteer plugins with puppeteer clusters?
- go - 在面向用户的组件中清理后台工作的典型方法
- javascript - 密码 bcrypt 返回未定义
- r - 两个整数矩阵按位置 R 的交集
- c++ - 为什么 C++ 数组中的溢出依赖于操作系统/编译器?
- javascript - reactjs useState 对象数组 Map
- c - 问题 pthread_mutex_lock 如果它在 for 循环中,则永远等待
- html - jQuery toggle 移动底部元素