如何在第二台计算机上安装Github SSH密钥 [英] How to setup Github SSH key on second computer

查看:163
本文介绍了如何在第二台计算机上安装Github SSH密钥的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一台电脑上安装了Github帐户。我还想使用第一台计算机使用的SSH密钥在第二台计算机上访问我的Github帐户。如何将SSH私钥导入新计算机用户配置文件?

I've got a Github account setup on one computer. I would like to also access my Github account on a second machine using the same SSH key I used for the first computer. How do I import the SSH private key into the new computers user profile?

cp ~/other_comp_github_key ~/.ssh/github

上述命令在Windows上的git bash控制台中没有完成这项工作。

The above command did not do the job in the git bash console on Windows.

推荐答案

如果github允许您将多个帐户关联在一起,那么最好创建一个新的私钥。 (在机器中共享私钥非常类似于在多个帐户上共享密码。)但并非所有服务都允许多个密钥,所以...

It'd be best to create a new private key if github allows you to have several associated with your account. (Sharing private keys among machines is very much like sharing passwords on multiple accounts.) But not all services allow multiple keys, so...

您不指定你复制了密钥的私有部分;请确保您复制私人部分。

You don't specify that you copied the private portion of the key; make sure you copy the private portion.

您不指定配置〜/ .ssh / config 阻止为 github.com 主机使用〜/ .ssh / github 键。确保你在你的〜/ .ssh / config 文件中添加一个新块,就像你偷取密钥的机器上的块一样。

You don't specify that you configured the ~/.ssh/config block to use the ~/.ssh/github key for the github.com host. Make sure you add a new block to your ~/.ssh/config file just like block on the machine you stole the key from.

host github.com
    IdentityFile ~/.ssh/github

(我不知道主机是 github.com - 如果你使用不同的主机名,那就使用它。)

(I don't know that the host is github.com -- if you use a different hostname, then use that.)

这篇关于如何在第二台计算机上安装Github SSH密钥的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆