Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
通过portablegit使用github时如何使用指定的密钥?_Git_Github_Ssh - Fatal编程技术网

通过portablegit使用github时如何使用指定的密钥?

通过portablegit使用github时如何使用指定的密钥?,git,github,ssh,Git,Github,Ssh,我有两个ssh密钥与github一起工作——我自己的和我所在组织的一个。 我的密钥由github gui客户端自动生成,另一个由portablegit生成。 我的.ssh文件夹如下所示: github_rsa <--- my key github_rsa.pub id_rsa <--- org key id_rsa.pub github\u rsa您可以通过添加到HOME/.sshaconfig文件: Host wpengine

我有两个ssh密钥与github一起工作——我自己的和我所在组织的一个。 我的密钥由github gui客户端自动生成,另一个由portablegit生成。 我的.ssh文件夹如下所示:

github_rsa            <--- my key
github_rsa.pub
id_rsa                <--- org key
id_rsa.pub

github\u rsa您可以通过添加到
HOME/.ssh
a
config
文件:

Host wpengine 
user git
hostname git.wpengine.com
IdentityFile ~/.ssh/myPrivateKey
您可以添加任意数量的“主机”条目,每个条目都有不同的
IdentityFile

例如,请参见“”

然后,您可以使用scp语法克隆您的回购协议:

git clone github.com-activehacker:activehacker/gfs.git gfs_jexchan
(而不是
ssh://git@github.com/activehacker/gfs.git
,它将无法引用特定的私钥,并且将始终返回到
id\u rsa

git clone github.com-activehacker:activehacker/gfs.git gfs_jexchan