git在提示我输入其他人密码时提示我

时间:2018-12-23 03:57:43

标签: git github

我正在尝试对我正在编辑的大型项目(不是原始作者)进行初始推送,当我推送项目github仓库时,它要求我在bitbucket上输入别人的密码? ??

我尝试在github上创建一个新帐户并重置全局用户名/密码,删除了钥匙串上与git相关的所有文件,并尝试更改目录名。

项目名称darrinwebster $ git push -u原始主机

“ otherPersonsBitbucketAccount.org”的密码:

远程:无效的用户名或密码

致命:'otherPersonsBitbucketAccount.org'身份验证失败

我希望git要求提供我的凭据(对于github),因为我已将存储库来源设置为我的帐户。

2 个答案:

答案 0 :(得分:0)

您可能想重置origin远程服务器的URL,使其指向您的GitHub帐户,而不是其他人的Bitbucket帐户。您可以使用以下内容来做到这一点:

git remote set-url origin https://github.com/example-user/example-repo.git

如果您愿意,也可以使用SSH URL:

git remote set-url origin git@github.com:example-user/example-repo.git

如果需要,您可以添加其他遥控器,然后推送到该遥控器:

git remote add github https://github.com/example-user/example-repo.git
git push -u github master

您当然可以使用您控制的任何网址;如果您想使用Bitbucket帐户而不是GitHub帐户,那就没问题了。

答案 1 :(得分:-3)

Git从git配置中获取用户名 因此,我将从检查git config(git config --global user.name)中的用户名开始。 如果出现问题,您可以使用git config --global user.name "John Doe"

更改用户名