使用具有SSH密钥的多个Github帐户
我最近被授予访问Github存储库的权限,我将称之为使用具有SSH密钥的多个Github帐户,git,powershell,github,ssh,Git,Powershell,Github,Ssh,我最近被授予访问Github存储库的权限,我将称之为work。对于这个问题,通过SSH密钥访问该存储库的权限已授予我 我为我的帐户使用SSH密钥(我将称之为me),这不会给我带来任何问题,并且对于该帐户下的任何存储库都会继续正常运行 我的config文件设置如下 Host me.github.com HostName github.com User git IdentityFile ~/.ssh/me Host work.github.com Ho
work
。对于这个问题,通过SSH密钥访问该存储库的权限已授予我
我为我的帐户使用SSH密钥(我将称之为me
),这不会给我带来任何问题,并且对于该帐户下的任何存储库都会继续正常运行
我的config
文件设置如下
Host me.github.com
HostName github.com
User git
IdentityFile ~/.ssh/me
Host work.github.com
HostName github.com
User git
IdentityFile ~/.ssh/work
当我尝试使用ssh add-l
时,两个密钥都会出现,并且两个帐户都添加了正确的公钥
发送命令ssh-Tgit@github.com
返回你好!您已成功通过身份验证,但GitHub不提供shell访问。
,尽管如果我发送命令ssh-Tgit@work.github.com
它以正确的方式响应
fetch和push的两个源都被设置为ssh链接,由git remote-v
我和其他几个人一起试过,但没有成功
我可能还应该包括我正在运行的Windows 10 LTSB build 14393、Powershell 5.1、git version 2.19.1.Windows.1和posh git 0.7.3.1,这些都是通过Chocolate安装的。首先,检查您的两个SSH密钥:
ssh -Tv me.github.com
ssh -Tv work.github.com
其次,您可以在repo中添加两个URL进行测试:
git remote set-url origin me.github.com:<auser>/<arepo>
git remote origin originWork work.github.com:<auser>/<arepo>
git远程设置url origin me.github.com:/
git remote origin originWork.github.com:/
(URL中不需要git@
)
从那里,您可以使用一个或另一个原点来拉/推