一直觉得通过不同的 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
参考: