git Sourcetree 远程:用户名或密码无效

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/45622960/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 05:05:53  来源:igfitidea点击:

Sourcetree remote: Invalid username or password

gitauthenticationgithubatlassian-sourcetree

提问by Sven van den Boogaart

Im trying to push to github with sourcetree but get the following error:

我尝试使用 sourcetree 推送到 github,但出现以下错误:

git -c diff.mnemonicprefix=false -c core.quotepath=false push -v --tags origin live_version:live_version remote: Invalid username or password. fatal: Authentication failed for 'https://github.com/myname/myrepo/' Pushing to https://github.com/myname/myrepo

Completed with errors, see above.

git -c diff.mnemonicprefix=false -c core.quotepath=false push -v --tags origin live_version:live_version remote: 无效的用户名或密码。致命:“ https://github.com/myname/myrepo/”的身份验证失败推送到 https://github.com/myname/myrepo

已完成,但有错误,请参见上文。

enter image description hereHowever when I go to

在此处输入图片说明但是当我去

tools > authentication > my github account

工具 > 身份验证 > 我的 github 帐户

And click edit > refresh oauth token enter image description hereA page opens and I get:

然后单击编辑 > 刷新 oauth 令牌 在此处输入图片说明打开一个页面,我得到:

Authentication Successful

认证成功

SourceTree has been successfully authenticated. You may now close this page.

It always worked but it suddenly stopped, i do not have two factor authentication. I tried deleting the account and adding it again to no avail. How can I get the connection working again so that I can push my project to github.

它总是有效,但突然停止了,我没有两因素身份验证。我尝试删除该帐户并重新添加它无济于事。我怎样才能让连接再次工作,以便我可以将我的项目推送到 github。

Sourcetree version 2.1.8.0

源树版本 2.1.8.0

回答by Sven van den Boogaart

I found the answer here, it is a known bug for version 2.1.8+

我在这里找到了答案,这是 2.1.8+ 版本的已知错误

The following steps fixed it for me:

以下步骤为我修复了它:

Tools > Options > Git > Update Embedded Git

Also pushing with the command line works.

也可以使用命令行进行推送。

EDIT

编辑

Also adding @Latisha's answer:

还添加@Latisha 的回答:

1. Do the above.
2. Close Sourcetree
3. Delete AppData\Local\Atlassian\SourceTree\passwd 
4. Restart SourceTree
5. Hurray!!!

回答by Alon Rosenfeld

I struggled with this a lot, what solved it for me on my Mac is:

我为此苦苦挣扎,在我的 Mac 上为我解决的问题是:

  • Open finder, click Cmd + Shift + g
  • enter ~/Library/
  • Go to Application Support/SourceTreefolder
  • delete userName@STAuth-bitbucket.org
  • Open KeyChain Access
  • search for sourctree
  • delete the 'login' item
  • clone your source from bitbucket
  • KeyChain will ask for you bitbucket pass
  • 打开查找器,单击 Cmd + Shift + g
  • 进入 ~/Library/
  • 转到Application Support/SourceTree文件夹
  • 删除用户名@STAuth-bitbucket.org
  • 打开钥匙串访问
  • 搜索源树
  • 删除“登录”项
  • 从 bitbucket 克隆你的源
  • KeyChain 会要求您提供 bitbucket 通行证

回答by 2sloth

I had the same problem for Sourcetree 2.10, but with the above solution not working.

我在 Sourcetree 2.10 上遇到了同样的问题,但上述解决方案不起作用。

Reverting to version 2.0 solved it.

恢复到 2.0 版解决了它。

Sourcetree download archive: (https://www.sourcetreeapp.com/download-archives)

Sourcetree 下载存档:(https://www.sourcetreeapp.com/download-archives

回答by Mohamed Nageh

I faced this issue when i updated Embedded Git. Solved it by removing passwd file. you can find it here. then restart source tree.

我更新时遇到了这个问题Embedded Git。通过删除 passwd 文件解决了这个问题。你可以在这里找到它。然后重新启动源树。

AppData\Local\Atlassian\SourceTree\passwd

AppData\Local\Atlassian\SourceTree\passwd

回答by MikeL

If you do have two-factor authentication enabled in GitHub you might have gotten here as well. In that case follow AlonR's answer(for Mac - worked for me) or Sven's answer(for Windows - untested) and then follow the instructions hereto make it work.

如果您确实在 GitHub 中启用了双因素身份验证,那么您也可能已经到了这里。在这种情况下,请遵循AlonR答案(对于 Mac - 对我有用)或Sven答案(对于 Windows - 未经测试),然后按照此处的说明进行操作。

  • Currently the GitHub token page is here.
  • 目前 GitHub 令牌页面在这里

回答by beibeitu

  1. Delete your saved account in tools\option dialog.
  2. Push or pull again, and SourceTree will ask you to input your login name and password.
  1. 在工具\选项对话框中删除您保存的帐户。
  2. 再次推或拉,SourceTree 会要求您输入登录名和密码。

回答by Abhishek

I had the same problem , I ReloggedIn to the account solved this error for me.

我遇到了同样的问题,我重新登录到该帐户为我解决了这个错误。

回答by emanuel.virca

I had the same problem and I fixed it by installing the latest version of git for windows

我遇到了同样的问题,我通过为 windows 安装最新版本的 git 来修复它

回答by lewis

For SourceTree 2.7.6 for macOS using embedded git I followed all the suggested answers but still had the same problem.

对于使用嵌入式 git 的 macOS 的 SourceTree 2.7.6,我遵循了所有建议的答案,但仍然遇到相同的问题。

The solution for me was to turn off two factor authentication.

我的解决方案是关闭两因素身份验证。

Obviously not ideal, but sometimes you just need to get your work done.

显然并不理想,但有时您只需要完成工作即可。

回答by 0xA0

On Windows try:

在 Windows 上尝试:

  1. Tools> Options> Authentication - delete from Git Saved Password your problem repo data (ex [email protected])
  2. Select tab with problem repo.
  3. Open terminal and make some git command (ex git pull origin) and you will be asked login and password. Input correct login and password. Login and password will be updated and all works again.
  1. 工具> 选项> 身份验证 - 从 Git 保存的密码中删除您的问题存储库数据(例如 [email protected]
  2. 选择带有问题回购的选项卡。
  3. 打开终端并执行一些 git 命令(例如 git pull origin),您将被要求登录名和密码。输入正确的登录名和密码。登录名和密码将被更新,并且一切正常。