Git / SourceTree - 远程无效的用户名或密码
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/34044308/
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
Git / SourceTree - remote invalid username or password
提问by Vincent Montalieu
I've just reinstalled SourceTree on my new computer and I'm having trouble when trying to push my commits.
我刚刚在新计算机上重新安装了 SourceTree,但在尝试推送提交时遇到了问题。
If I use the built-in Push button from SourceTree, it brings up a dialog where I enter my username and password but then I get an error: remote invalid username or password
.
如果我使用 SourceTree 的内置 Push 按钮,它会弹出一个对话框,我在其中输入我的用户名和密码,但随后出现错误:remote invalid username or password
.
The strangest thing is that if I bring the Git console by clicking on the Console button in SourceTree, type git push
then enter the exact same credentials, it works...
最奇怪的是,如果我通过单击 SourceTree 中的“控制台”按钮打开 Git 控制台,键入git push
然后输入完全相同的凭据,它会起作用……
I'm assuming SourceTree might be overriding some Git config somehow but I can't find a solution.
我假设 SourceTree 可能会以某种方式覆盖某些 Git 配置,但我找不到解决方案。
I tried deleting all credentials saved by SourceTree, I disallowed SourceTree to modify my Git config in the Tools > General menu but it didn't change anything...
我尝试删除 SourceTree 保存的所有凭据,我不允许 SourceTree 在“工具”>“常规”菜单中修改我的 Git 配置,但它没有更改任何内容...
Thanks for your help!
谢谢你的帮助!
回答by Anuj Panwar
If you are using SourceTree on Mac then go to SourceTree -> Preference -> Network
如果您在 Mac 上使用 SourceTree,请转到 SourceTree -> Preference -> Network
You will get the list of username for Remote URLs. You can update username there and next push/pull event that username will start getting reflect.
您将获得远程 URL 的用户名列表。您可以在那里更新用户名,然后用户名将开始反映下一个推/拉事件。
回答by Andrey Stukalin
On Windows you might try to remove OR edit the %LOCALAPPDATA%\Atlassian\SourceTree\passwd
file. Edit means removing only the lines which correspond to the failed credentials
在 Windows 上,您可能会尝试删除或编辑%LOCALAPPDATA%\Atlassian\SourceTree\passwd
文件。编辑意味着仅删除与失败凭据对应的行
回答by Genki
I had two factor authentication on, so I needed to create new Personal access token in github.com settings page and use it as my password.
我启用了两因素身份验证,因此我需要在 github.com 设置页面中创建新的个人访问令牌并将其用作我的密码。
回答by Samet ?ZTOPRAK
SourceTree -> Preference --> accounts you can delete and add your account again and then try SourceTree -> Preference set Protocol = HTTPS
SourceTree -> Preference --> 可以删除并再次添加帐户的帐户,然后尝试 SourceTree -> Preference set Protocol = HTTPS
回答by BigMiner
One possible answer to this problem is to update your local version of git or update your embedded version of git. Newer versions of sourcetree do not play nice with older versions of git.
这个问题的一个可能的答案是更新 git 的本地版本或更新 git 的嵌入版本。较新版本的 sourcetree 与较旧版本的 git 不兼容。
回答by davity
Happend to me on SourceTree for Mac.
在 Mac 版 SourceTree 上发生在我身上。
Username from SourceTree -> Preference -> Accounts
and SourceTree -> Preference -> Network
need to be aligned.
用户名来自SourceTree -> Preference -> Accounts
和SourceTree -> Preference -> Network
需要对齐。
回答by shabbado
I was able to fix this on SourceTree 3.1.1
by going to Preferences->Account->Edit->Connect Account
.
我能够SourceTree 3.1.1
通过去解决这个问题Preferences->Account->Edit->Connect Account
。
回答by Daniel
SourceTree
on Mac then go to SourceTree -> Preference -> Network
.
You'll see your username and GitHub location. Remove it.
Next, when you push
to your repo
, you'll be prompted for username
and password
(to save to chain).
SourceTree
在 Mac 上,然后转到SourceTree -> Preference -> Network
. 您将看到您的用户名和 GitHub 位置。去掉它。接下来,当您push
访问 时repo
,系统会提示您输入username
和password
(保存到链)。
Ideally, there was a password
field here.
理想情况下,这里有一块password
田地。