我和一个朋友共用我的电脑。我已经在Windows 7上使用git bash shell推送到GitHub。现在我们在那台电脑上做一个不同的项目,我需要她推到她的账户上。但它一直试图使用我的用户名,并说我没有访问她的存储库:

$ git push her_github_repository our_branch
ERROR: Permission to her_username/repository.git denied to my_username.
fatal: The remote end hung up unexpectedly

重要:2021年8月13日删除了对密码验证的支持。


当前回答

转到凭证管理器 转到Windows凭证 删除通用凭证下的条目 再次尝试连接。

其他回答

你可以使用git remote add origin-username https://username@github.expedia.biz/repository_name.git为另一个用户名添加一个新的远程URL

在这之后,如果你使用git push -u origin-username master进行推送,这会提示你输入密码。

转到凭证管理器 转到Windows凭证 删除通用凭证下的条目 再次尝试连接。

本例将值johndoe@example.com写入配置名user.email。它使用——global标志,所以这个值是为当前操作系统用户设置的。

$ git config --global user.name "John Doe"
$ git config --global user.email johndoe@example.com

我刚刚添加了额外的用户:

回购的设置, 管理访问, 邀请合作者

这对我很有效。

如果你有https://desktop.github.com/ 然后你可以去首选项(或选项)->帐户 然后签出签入。