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