GitHub 如何使用多账户

一直觉得通过不同的 ssh 秘钥来使用 GitHub 多账户有些笨挫。昨天发现 gitcredentials 提供一个 useHttpPath 的设置能够解决问题。

useHttpPath
By default, Git does not consider the "path" component of an http URL to be worth matching via external helpers. This means that a credential stored for https://example.com/foo.git will also be used for https://example.com/bar.git. If you do want to distinguish these cases, set this option to true.

修改 git config 类似于:

[credential]
    helper = osxkeychain
    useHttpPath = true

参考:

  • Multiple GitHub Accounts and Git-Credential-OSXKeychain
  • Using Public Keys with Multiple Github Accounts
  • Multiple SSH Keys settings for different github account

你可能感兴趣的:(GitHub 如何使用多账户)