Two GitHub accounts on the same computer

こ雲淡風輕ζ 提交于 2021-01-28 10:26:39

问题


First of all I know that this question has been asked and answered several times, but all solutions that I've found don't work.

Task is very simple - I have two GitHub accounts, one personal and second for business.

I tried to use a few configurations, but all were like this:

Host github.com-personal
    HostName github.com
    User kagarlickij
    IdentityFile ~/.ssh/github_kagarlickij_private

Host github.com-business
    HostName github.com
    User dmytriy-kagarlickij
    IdentityFile ~/.ssh/github_dmytriy-kagarlickij-business_private

... and it doesn't work. It works only if Host is github.com . Not github.com-business , not business.github.com , etc

Any ideas how to manage this?


回答1:


The User for ssh (push/pull) access is always "git", not your username.

Edit: Also, you must use the ssh alias from your config in the clone url:

git clone github.com-personal:kagarlickij/terraform-aws-vm.git

If you do that ssh uses the hostname, user and identify from the corresponding config file section.



来源:https://stackoverflow.com/questions/46666016/two-github-accounts-on-the-same-computer

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!