SSH 配置未对 github 企业和 github.com 进行身份验证
SSH config not authenticating for github enterprise and github.com
我一直在尝试让 git 使用我的 github.com 帐户和我的 github 企业帐户在我的笔记本电脑上工作。我一直在关注 this guide and this one to figure out how to edit the SSH config file and get authenticated. I also looked at this SO question,它非常相似,并且做了上面提到的 ssh-add(对于两个键)。
总的来说,我在不同的文件夹(github 和 github_enterprise)中创建了单独的 public 密钥,并将它们添加到两个在线帐户中。然后我编辑了 SSH 配置文件以包含不同的站点、用户名和密钥,然后执行了 ssh-add(即:ssh-add ~/.ssh/github.com/id_rsa 和 ~/.ssh/github_企业/id_rsa)。我尝试 ssh(通过执行 ssh github.com 或 ssh github_enterprise),但它超时,我必须控制 X-C。
这是我的 SSH 配置文件:
Host github.com
HostName github.com
Port 4096
IdentityFile /home/my_username/.ssh/github/id_rsa
User my_github.com_username
Host github_enterprise
HostName github_enterprise
Port 4096
IdentityFile /home/my_username/.ssh/github_enterprise/id_rsa
User my_github_enterprise_username
Port 4096
看起来不对,应该是 Port 22
或完全省略,因为这是默认设置。此外,通过 SSH 连接到 GitHub 的通用用户名是 git,就像在 User git
中一样。请勿在此处使用您的 GitHub 用户名。
我一直在尝试让 git 使用我的 github.com 帐户和我的 github 企业帐户在我的笔记本电脑上工作。我一直在关注 this guide and this one to figure out how to edit the SSH config file and get authenticated. I also looked at this SO question,它非常相似,并且做了上面提到的 ssh-add(对于两个键)。
总的来说,我在不同的文件夹(github 和 github_enterprise)中创建了单独的 public 密钥,并将它们添加到两个在线帐户中。然后我编辑了 SSH 配置文件以包含不同的站点、用户名和密钥,然后执行了 ssh-add(即:ssh-add ~/.ssh/github.com/id_rsa 和 ~/.ssh/github_企业/id_rsa)。我尝试 ssh(通过执行 ssh github.com 或 ssh github_enterprise),但它超时,我必须控制 X-C。
这是我的 SSH 配置文件:
Host github.com
HostName github.com
Port 4096
IdentityFile /home/my_username/.ssh/github/id_rsa
User my_github.com_username
Host github_enterprise
HostName github_enterprise
Port 4096
IdentityFile /home/my_username/.ssh/github_enterprise/id_rsa
User my_github_enterprise_username
Port 4096
看起来不对,应该是 Port 22
或完全省略,因为这是默认设置。此外,通过 SSH 连接到 GitHub 的通用用户名是 git,就像在 User git
中一样。请勿在此处使用您的 GitHub 用户名。