简体   繁体   English

当我尝试推送时,git提示我输入别人的密码

[英]git is prompting me for someone elses password when I try to push

I'm attempting to make an initial push on a large project that I'm editing (I'm not the original author) and when I go to push the projectmy github repo it asks me for someone elses password on bitbucket??? 我正在尝试对正在编辑的一个大项目进行初步推送(我不是原始作者),当我去推送该项目时,我的github仓库要求我在bitbucket上输入别人的密码?

I've tried creating a new account on github and reseting global username/ password, deleted all files related to git on keychain and tried changing the directory names. 我尝试在github上创建一个新帐户并重置全局用户名/密码,删除了钥匙串上与git相关的所有文件,并尝试更改目录名称。

project-name darrinwebster$ git push -u origin master 项目名称darrinwebster $ git push -u origin master

Password for 'otherPersonsBitbucketAccount.org': “ otherPersonsBitbucketAccount.org”的密码:

remote: Invalid username or password 远程:无效的用户名或密码

fatal: Authentication failed for 'otherPersonsBitbucketAccount.org' 致命的:“ otherPersonsBitbucketAccount.org”的身份验证失败

I'm expecting git to ask for my credentials (for github) as I've set the repository origin to my account. 我期望git要求我提供凭据(适用于github),因为我已将存储库来源设置为我的帐户。

You probably want to reset the URL of your origin remote to point to your GitHub account instead of the other person's Bitbucket account. 您可能希望将origin远程站点的URL重置为指向您的GitHub帐户,而不是其他人的Bitbucket帐户。 You can do this with something like the following: 您可以使用以下类似方法执行此操作:

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

You could also use an SSH URL if you prefer that: 如果您愿意,也可以使用SSH URL:

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

If you want, you can just add a different remote, and then push to that remote instead: 如果需要,您可以仅添加其他远程,然后推送到该远程:

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

You can of course use any URL you control; 您当然可以使用您控制的任何URL。 if you wanted to use a Bitbucket account instead of a GitHub account, that would be fine. 如果您想使用Bitbucket帐户而不是GitHub帐户,那很好。

Git takes the username from the git config So I would start with checking the username from git config ( git config --global user.name ). Git从git config中获取用户名,所以我将从检查git config( git config --global user.name )中的用户名开始。 If its the issue you can change the username with git config --global user.name "John Doe" 如果出现问题,您可以使用git config --global user.name "John Doe"更改用户名。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM