git 如何让Egit记住密码和用户名?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15331166/
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
How to make Egit remember password and username?
提问by sfendell
I'm working onn a project in Eclipse hosted on Github. Everytime I want to push, a dialog pops up asking for username and password. Anybody know how to save these so I don't have to keep typing them in everytime? I'm using Egit in Eclipse 4.2.1
我正在 Eclipse 中处理一个托管在 Github 上的项目。每次我想推送时,都会弹出一个对话框,要求输入用户名和密码。有人知道如何保存这些,这样我就不必每次都输入它们了吗?我在 Eclipse 4.2.1 中使用 Egit
回答by Sean Snyder
Struggled with this for a while too:
也为此苦苦挣扎了一段时间:
- Go to the Git Perspective -> Expand your Project -> Expand Remotes -> Expand the remote you want to save your password.
- Right-click on the Fetch or Push -> Select Change Credentials...
- Enter username and password -> Select Ok
- 转到 Git Perspective -> Expand your Project -> Expand Remotes -> 展开要保存密码的遥控器。
- 右键单击 Fetch 或 Push -> 选择 Change Credentials...
- 输入用户名和密码 -> 选择确定
This is the workaround I've found to work. It's a bit manual for each Git project, but it works ^_^.
这是我发现有效的解决方法。每个 Git 项目都有一点手册,但它有效^_^。
回答by VonC
You could use ssh url for your repo, and add your ssh public and private key to EGit.
您可以将 ssh url 用于您的存储库,并将您的 ssh 公钥和私钥添加到 EGit。
Or you can activate a credential helper, in order to git to record your credentials.
或者您可以激活凭证助手,以便 git 记录您的凭证。
回答by VonC
That bug (for httpsURI) can be linked to the (still opened in 2014) bug 355442:
该错误(对于httpsURI)可以链接到(仍然在 2014 年开放)错误 355442:
On every push, egit will ask for password for a secure store.
The problem is, I never check the option to store the repository username and password in the push dialog.
每次推送时,egit 都会要求输入安全存储的密码。
问题是,我从不检查在推送对话框中存储存储库用户名和密码的选项。
(Meaning if you forget to enter the credentials, it won't ask you again for it)
(这意味着如果您忘记输入凭据,它不会再次要求您输入)
Reproducible: Always
Steps to Reproduce:
- Push to upstream with the "store username and password in secure store" option unchecked.
- push again.
可重现:始终
重现步骤:
- 在未选中“在安全存储中存储用户名和密码”选项的情况下推送到上游。
- 再推。
Getting prompted constantly is pretty annoying but what is more annoying is that I have to uncheck the checkbox every time it shows up.
If the password is to be stored in the secure storage then the dialog will never prompt again. Wouldn't it make more sense for the checkbox to be unchecked by default?
不断收到提示很烦人,但更烦人的是每次出现时我都必须取消选中该复选框。
如果密码要存储在安全存储中,则该对话框将不再提示。默认情况下取消选中复选框不是更有意义吗?
So a workaround is to Remote>Fetch, using a "Custom URI" (as Antoinementioned before), in order to enter again the URI, and enter your credentials there, selecting "Store in Secure Store".
Subsequent push should work fine, since they are using the same URI you just entered.
因此,解决方法是使用“自定义 URI”(如Antoine之前提到的)远程>获取,以便再次输入 URI,并在那里输入您的凭据,选择“存储在安全存储中”。
后续推送应该可以正常工作,因为它们使用的是您刚刚输入的相同 URI。
回答by rifle2000
I had different problem. My credentials where saved permanently and I couldn't delete nor change them. Everytime I had Auth Fail from git and maybe You got same problem but in your case it prompts again. Maybe it will help You or others. I went to Preferences -> General -> Security -> Secure storage and in Contents tab deleted "Default Secure Storage" and restarted Eclipse. Then eGit asked me for password again and successfully saved it in storage.
我有不同的问题。我的凭据永久保存,我无法删除或更改它们。每次我从 git 遇到 Auth Fail 时,也许你遇到了同样的问题,但在你的情况下它会再次提示。也许它会帮助你或其他人。我转到首选项 -> 常规 -> 安全性 -> 安全存储并在内容选项卡中删除“默认安全存储”并重新启动 Eclipse。然后eGit再次要求我输入密码并成功将其保存在存储中。
回答by Dennis
This can happen if the saved password in secure storage doesn't match with the typed one. Here's how you can fix it:
如果安全存储中保存的密码与键入的密码不匹配,就会发生这种情况。以下是修复它的方法:
From Eclipse toolbar navigate to Window > Preferences > Security > Secure Storage > Contents Tab > [Default Secure Storage] > GIT > "whatever github url"
Select the url and delete the current user.
Eclipse will ask for a restart. Do it.
Push new changes and this time egit will prompt to save credentials in secure storage which was removed from the previous step.
从 Eclipse 工具栏导航到 Window > Preferences > Security > Secure Storage > Contents Tab > [Default Secure Storage] > GIT > "whatever github url"
选择 url 并删除当前用户。
Eclipse 将要求重新启动。做吧。
推送新的更改,这次 egit 将提示将凭据保存在安全存储中,该存储已从上一步中删除。
回答by Dominic Cerisano
Secure Storage is your direct provider of credentials.
安全存储是您的凭证的直接提供者。
So, go to:
所以,去:
- Window->Preferences->General->Network
- Change Provider to "Direct"
- 窗口->首选项->通用->网络
- 将提供商更改为“直接”
This should really be the default since Secure Storage is the default provider in Eclipse.
这应该是默认设置,因为 Secure Storage 是 Eclipse 中的默认提供程序。
You can also change the git preferences to not pop up confirmation dialogs and the overall result will be a very fast workflow
您还可以更改 git 首选项以不弹出确认对话框,总体结果将是一个非常快速的工作流程