Sourcetree 推送错误的用户?

Sourcetree pushing with the wrong user?

背景:

问题:

我能够通过打开我的 Sourcetree userhosts 文件来解决问题,该文件位于(在 Windows 10):C:\Users\<USERNAME>\AppData\Local\Atlassian\SourceTree\userhosts,如 Atlassian's documentation for how to reset your Sourctree settings 中所暗示].

文件只包含这些行:

github.com
<my-rarely-used-account>@gmail.com

我删除了引用我很少使用的帐户的第二行,重新启动 Sourcetree,尝试再次推送,这次它提示我输入 GitHub 密码,我可以看到用户名是 (正确)我的主要 GitHub 用户名。输入密码,推送成功

Atlassian 团队为此提供了解决方案(here):

  • 打开存储库
  • 点击“设置”
  • 双击列表中的“来源”项目
  • 编辑 url 以在回购的 URL 之前添加您的用户名。这里有些例子: https://USERNAME@contoso.com/repo/blah.git
    https://USERNAME@github.com/host/repo_name
  • 下次尝试推送或拉取时,系统会提示您输入密码