eclipse EGit 和 GitHub 的“身份验证失败”错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3601805/
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
"Auth Failed" error with EGit and GitHub
提问by tehsis
I've installed EGit plugin at Eclipse Helios and I'm trying to use it with my GitHub account, but when I try to configure it I get an "Auth Failed" error.
我已经在 Eclipse Helios 上安装了 EGit 插件,我正在尝试将它与我的 GitHub 帐户一起使用,但是当我尝试配置它时,我收到了“身份验证失败”错误。
I'd been googling it but no luck... it seems to be a problem with my passphrase but AFAIK EGit is looking at the right place (/home/user/.ssh/id_rsa
) and I've no problem in connect by ssh
or git
console client.
我一直在谷歌上搜索它但没有运气......这似乎是我的密码有问题,但 AFAIK EGit 正在寻找正确的位置 ( /home/user/.ssh/id_rsa
) 并且我在通过ssh
或git
控制台客户端连接时没有问题。
Some blogs says that is a problem with the URI and the Egit's parser but I still haven't found a solution.
一些博客说这是 URI 和 Egit 解析器的问题,但我仍然没有找到解决方案。
回答by Andrei Petrenko
My answer may be outdated but hopefully it can be useful for someone.
我的答案可能已经过时,但希望它对某人有用。
In your Eclipse go to Window > Preferences > General > Network Connections > SSH2(or just type "SSH2" in preferences window filter box).
In "Key Management"tab press "Generate RSA Key..."button. Optionally you can add comment (usually e-mail address) and passphrase to your key. Passphrase will be used during authentication on GitHub.
- Copy your generated public key (in a box just below "Generate RSA Key..." button) and add it to your GitHub account.
- Press "Save Private Key..."button to save your private RSA key into file. By default keys are stored in SSH2 home directory (see "General" tab).
在您的 Eclipse 中,转到Window > Preferences > General > Network Connections > SSH2(或者在首选项窗口过滤框中键入“SSH2”)。
在“密钥管理”选项卡中,按 “生成 RSA 密钥...”按钮。您可以选择向密钥添加注释(通常是电子邮件地址)和密码。密码短语将在 GitHub 上的身份验证期间使用。
- 复制您生成的公钥(在“生成 RSA 密钥...”按钮下方的框中)并将其添加到您的 GitHub 帐户。
- 按“保存私钥...”按钮将您的私人 RSA 密钥保存到文件中。默认情况下,密钥存储在 SSH2 主目录中(请参阅“常规”选项卡)。
That's it! Now you should be able to push your code to GitHub repo.
就是这样!现在您应该能够将您的代码推送到 GitHub 存储库。
回答by Akseli Palén
I had exactly same problem but I found the cure from a Eclipse bug report!
我遇到了完全相同的问题,但我从 Eclipse 错误报告中找到了解决方法!
An environment variable named GIT_SSH must be set with a path to a ssh executable [1].
必须使用 ssh 可执行文件 [1] 的路径设置名为 GIT_SSH 的环境变量。
For example on Ubuntu Linux (10.10 64bit):
例如在 Ubuntu Linux(10.10 64 位)上:
> export GIT_SSH=/usr/bin/ssh
> eclipse
After that pushes to GitHub repository work like they should. I tested this with Eclipse Galileo and Indigo.
之后推送到 GitHub 存储库就像他们应该的那样工作。我用 Eclipse Galileo 和 Indigo 对此进行了测试。
The problem is really annoying and the solution is far from nice. For now, making the solution permanent for, at least Ubuntu users, one must make the env variable permanent. It can be done by adding the export command to ~/.profile or ~/.bashrc [2]. For example:
这个问题真的很烦人,解决方案也很糟糕。目前,至少为 Ubuntu 用户提供永久解决方案,必须使 env 变量永久化。可以通过将 export 命令添加到 ~/.profile 或 ~/.bashrc [2] 来完成。例如:
> cd ~
> echo "export GIT_SSH=/usr/bin/ssh" >> .profile
And then restart Eclipse to take effect.
然后重启Eclipse即可生效。
Sources:
资料来源:
- [1] The solution is from this bug report
- [2] Ubuntu Community Documentationfor persistent environment variables:
- [1] 解决方案来自此错误报告
- [2]持久环境变量的Ubuntu 社区文档:
回答by hari_sree
I resolved it by selecting http
as the protocol and giving my GitHub username and password.
我通过选择http
协议并提供我的 GitHub 用户名和密码来解决它。
回答by Rushal A
After spending hours looking for the solution to this problem, I finally struck gold by making the changes mentioned on an Eclipse Forum.
在花了几个小时寻找这个问题的解决方案之后,我终于通过在Eclipse 论坛上进行的更改获得了成功。
Steps:
脚步:
Prerequisites: mysysgit is installed with default configuration.
先决条件:mysysgit 是使用默认配置安装的。
1.Create the file C:/Users/Username/.ssh/config (Replace "Username" with your Windows 7 user name. (e.g. C:/Users/John/.ssh/config)) and put this in it:
1.创建文件 C:/Users/Username/.ssh/config(将“用户名”替换为您的 Windows 7 用户名。(例如 C:/Users/John/.ssh/config))并将其放入其中:
Host github.com
HostName github.com
User git
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa
2.Try setting up the remote repository now in Eclipse.
2.现在尝试在 Eclipse 中设置远程存储库。
Cheers. It should work perfectly.
干杯。它应该可以完美运行。
回答by gennad
You need to install msysgit, after installing you need to open Git Bash and enter there these commands:
你需要安装 msysgit,安装后你需要打开 Git Bash 并在那里输入这些命令:
$ git config --global user.name "Gennadiy Zlobin" (your name)
$ git config --global user.email [email protected] (your email)
$ ssh-keygen -C "[email protected]" -t rsa (your email)
Now your generated keys are in C:\Users\username\.ssh
(in Windows 7).
Next you load the content of your public key to your project on Github
In Eclipse open Window->Preferences->General->Network->SSH2
and set your ~/.ssh
as SSH Home
现在您生成的密钥在C:\Users\username\.ssh
(在 Windows 7 中)。
接下来,您将公钥的内容加载到 Github 上的项目中
在 Eclipse 中打开Window->Preferences->General->Network->SSH2
并将您的设置~/.ssh
为SSH Home
After that go to Key Management tab
and Load existing Key- set here your private key in ~/.ssh
.
之后转到Key Management tab
并加载现有密钥- 在此处设置您的私钥~/.ssh
。
After that you can push your project to Github (but I set ssh protocol, not git+ssh).
之后你可以将你的项目推送到 Github(但我设置的是 ssh 协议,而不是 git+ssh)。
回答by volkan
I solved same problem with adding my key to ssh;
我通过将密钥添加到 ssh 解决了同样的问题;
ssh-add ~/.ssh/id_rsa
then entered the passphrase and need restart.
然后输入密码并需要重新启动。
回答by Jeshurun
For *nix users who are using SSH:
对于使用 SSH 的 *nix 用户:
Make sure the username for your account on your local machine does not differ from the username for the account on the server. Apparently, eGit does not seem to be able to handle this. For example, if your username on your local machine is 'john', and the account you are using on the server is named 'git', egit simply fails to connect (for me anyways). The only work around I have found is to make sure you have identical usernames in both the local machine and the server.
确保您在本地计算机上的帐户的用户名与服务器上的帐户的用户名不同。显然,eGit 似乎无法处理这个问题。例如,如果您在本地计算机上的用户名是“john”,而您在服务器上使用的帐户名为“git”,则 egit 只是无法连接(对我而言)。我发现的唯一解决方法是确保您在本地计算机和服务器中具有相同的用户名。
回答by Melissa Rice
At the link below I posted what worked for me...
在下面的链接中,我发布了对我有用的内容...
回答by drkvogel
My fourpenneth: my SSH keys were set up in Cygwin, at C:\cygwin\home\<user>.ssh, so I pointed SSH to this folder instead of the default (Win7) C:\Users\<user>\ssh, as per these instructions: http://wiki.eclipse.org/EGit/User_Guide/Remote#Eclipse_SSH_Configuration
我的四项:我的 SSH 密钥是在 Cygwin 中设置的,位于 C:\cygwin\home\<user>.ssh,所以我将 SSH 指向这个文件夹,而不是默认的 (Win7) C:\Users\<user>\ssh ,按照这些说明:http: //wiki.eclipse.org/EGit/User_Guide/Remote#Eclipse_SSH_Configuration
and used the ssh protocol, and it works fine. Trying to use the git protocol still gives "User not supported on the git protocol", though.
并使用了 ssh 协议,它工作正常。但是,尝试使用 git 协议仍然会给出“git 协议不支持用户”。
回答by Roger
For you who, like me, already did setup you ssh-keys but still get the errors:
对于像我一样已经设置了 ssh-keys 但仍然出现错误的人:
Make sure you did setup a push remote. It worked for me when I got both the Cannot get remote repository refs-problems ("... Passphrase for..." and "Auth fail" in the "Push..." dialog).
确保您确实设置了推送遥控器。当我同时遇到无法获取远程存储库 refs-problems(“... Passphrase for...”和“Push...”对话框中的“Auth fail”)时,它对我有用。
Provided that you already:
前提是你已经:
Setup your SSH keys with Github (Window > Preferences > General > Network Connections > SSH2)
Setup your local repository (you can follow this guidefor that)
Created a Github repository (same guide)
使用 Github 设置 SSH 密钥(Window > Preferences > General > Network Connections > SSH2)
设置您的本地存储库(您可以按照本指南进行操作)
创建了一个 Github 存储库(相同的指南)
... here's how you do it:
...这是你如何做到的:
- Go to the Git Repositories view(Window > Show View > Other > Git Repositories)
- Expand your Repository and right click Remotes--> "Create Remote"
- "Remote Name": origin, "Configure push": checked --> click "OK"
- Click the "Change..."button
- Paste your git URIand select protocol ssh--> click "Finish"
- Now, click "Save and Push"and NOW you should get a password prompt --> enter the public key passphrasehere (provided that you DID (and you should) setup a passphrase to your public key) --> click "OK"
- Now you should get a confirmation window saying "Pushed to YourRepository- origin" --> click "OK"
- Push to upstream, but this time use "Configured remote repository"as your Destination Git repository
- Go get yourself a well earned cup of coffee!
- 转到Git 存储库视图(窗口 > 显示视图 > 其他 > Git 存储库)
- 展开您的存储库并右键单击 Remotes--> “Create Remote”
- “远程名称”:来源,“配置推送”:选中 -->单击“确定”
- 单击“更改...”按钮
- 粘贴您的 git URI并选择协议ssh-->单击“完成”
- 现在,单击“保存并推送”,现在您应该会收到密码提示 -->在此处输入公钥密码(前提是您确实(并且应该)为您的公钥设置了密码)-->单击“确定”
- 现在您应该会看到一个确认窗口,上面写着“已推送到您的存储库- 来源”-->单击“确定”
- 推送到 upstream,但这次使用“配置的远程存储库”作为您的目标 Git 存储库
- 去给自己买一杯好喝的咖啡吧!