change github account mac command line

后端 未结 1 566
庸人自扰
庸人自扰 2020-12-02 01:02

I have two github accounts, one for work one for home. I am working on a personal project and can\'t push to origin master because it says I\'m still logged in to my work ac

相关标签:
1条回答
  • 2020-12-02 01:28

    The GitHub token is only used for non-ssh communications.

    But if you are pushing to GitHub using https address, and still register as your first account instead of the second one, that should mean you don't refer to the right public/private keys matching your public key on second account.
    See, for instance, the blog post "Quick Tip: How to Work with GitHub and Multiple Accounts", which manages those public/private keys through a ssh config file:

    #Default GitHub
    Host github.com
      HostName github.com
      User git
      IdentityFile ~/.ssh/id_rsa
    
    Host github-COMPANY
      HostName github.com
      User git
      IdentityFile ~/.ssh/id_rsa_COMPANY
    
    0 讨论(0)
提交回复
热议问题