EGit 和 GitHub 的“ Auth Fail”错误

我已经在 Eclipse Helios 安装了 EGit 插件,并试图将它用于我的 GitHub 帐户,但是当我试图配置它时,我得到了一个“ Auth Fail”错误。

我一直在谷歌它,但没有运气... 它似乎是一个问题,我的密码短语,但 AFAIK EGit 正在寻找正确的地方(/home/user/.ssh/id_rsa) ,我没有问题在连接的 sshgit控制台客户端。

一些博客说这是 URI 和 Egit 解析器的问题,但我还没有找到解决方案。

118477 次浏览

I updated the plugin with the nightly builds: http://www.eclipse.org/egit/download/

With an update, it worked for me. (Eclipse Helios, Mac OS X)

You need to install msysgit, after installing you need to open Git Bash and enter there these commands:

$ git config --global user.name "Gennadiy Zlobin" (your name)
$ git config --global user.email gennad.zlobin@gmail.com (your email)
$ ssh-keygen -C "gennad.zlobin@gmail.com" -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

After that go to Key Management tab and Load existing Key - set here your private key in ~/.ssh.

After that you can push your project to Github (but I set ssh protocol, not git+ssh).

Have you tried to use the ssh protocol instead on git+ssh ? I've got the same problem, and that solved it, even though official documentation tells to use git+ssh

My answer may be outdated but hopefully it can be useful for someone.

  1. In your Eclipse go to Window > Preferences > General > Network Connections > SSH2 (or just type "SSH2" in preferences window filter box).

  2. 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.

  3. Copy your generated public key (in a box just below "Generate RSA Key..." button) and add it to your GitHub account.
  4. 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).

That's it! Now you should be able to push your code to GitHub repo.

I resolved it by selecting http as the protocol and giving my GitHub username and password.

I had exactly same problem but I found the cure from a Eclipse bug report!

An environment variable named GIT_SSH must be set with a path to a ssh executable [1].

For example on Ubuntu Linux (10.10 64bit):

> 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.

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:

> cd ~
> echo "export GIT_SSH=/usr/bin/ssh" >> .profile

And then restart Eclipse to take effect.

Sources:

I solved same problem with adding my key to ssh;

ssh-add ~/.ssh/id_rsa

then entered the passphrase and need restart.

I found a post on the Eclipse forums that solved this problem for me.

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

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.

On Windows, setting GIT_SSH to openssh that comes with msys git didn't work (Eclipse hung during commit). Setting it to TortoisePlink solved the problem (I guess original plink would work as well). The added bonus is now Eclipse uses keys stored in pageant.

After spending hours looking for the solution to this problem, I finally struck gold by making the changes mentioned on an Eclipse Forum.

Steps:

Prerequisites: mysysgit is installed with default configuration.

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:

Host github.com
HostName github.com
User git
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa

2.Try setting up the remote repository now in Eclipse.

Cheers. It should work perfectly.

For *nix users who are using SSH:

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.

I was having the same issue which it seems was down to config issue. The github mac osx app had created a ssh private key called github_rsa

In your Eclipse go to Window > Preferences > Network Connections > SSH2

In the general tab you should see SSH2 home /Users/<you username>/.ssh you'll probably see id_dsa,id_rsa defined as private keys.

Click 'Add private key' and select github_rsa located /Users/<you username>/.ssh

IF YOU HAVE PEM FILE: In Eclipse go to Window > Preferences > Network Connections > SSH2, and then add path to your PEM file to "Private keys" and that should solve the problem.

For you who, like me, already did setup you ssh-keys but still get the errors:

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).

Provided that you already:

  1. Setup your SSH keys with Github (Window > Preferences > General > Network Connections > SSH2)

  2. Setup your local repository (you can follow this guide for that)

  3. Created a Github repository (same guide)

... 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 URI and select protocol ssh --> click "Finish"
  • Now, click "Save and Push" and NOW you should get a password prompt --> enter the public key passphrase here (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!

I wanted to make public once me too a google code fix and got the same error. Started with This video, but at Save and publish got an error. I have seen there are several question regarding to this. Some are Windows users, those are the most lucky, because usually no problems with permissions and some are Linux users.

I have a mac for mobile development use and very often meet this problems. The source for this problems is the "platform independent" solutions, which doesn't care enough for mac and they don't have access to keychain, where are stored the certificates, .pem files and so on.

All I wanted is to not make any environment settings, nor command line, just simple GUI based clicks, like a regular user.

Half part was done with Eclipse Git plugin, second part (push to Github) was done with Mac Github

Nice and easy :)

All can be done with with that native appp if I would start to learn it, I just need the push functionality from him.

Hoping it will help a mac user once.

I discovered that if I set up the two-step authentication in github, Eclipse isn't able to connect to Github - which makes sense because the two-step authentication in github requires you to input a number from an SMS (and Eclipse wouldn't have this information).

If this is your scenario, you might consider de-activating your two-step authentication in github, and see if that helps.

I resolved it by selecting https as the protocol and then adding my github username and password

For existing ssh keys, I think that it's a bug in Eclipse Juno 3.8.

What I did:

1) Load the existing key by going to: Window > Preferences > "Search ssh" > Key Management Tab > Load Existing Key > Select the private key which you already have

2) Save that key by clicking the button Save Private Key. Let's name it id_dsa_github

3) Now check if push and pull are working or not. It should be.

4) Now in the general tab, remove the private key id_dsa_github and add your previous private key by clicking the button Add private key

Now you are good to go. It's taking at least one time to do all the things from EGit to register, I guess.

In your GIT view where you have your repositories you will see a structure such as:

  • branches
  • tags
  • references
  • remotes
  • etc...

Click on remotes, right-click on the url of the repository there and select 'Change Credentials'.

I run into the same issue.

I thought it's something to do with my credentials and authentication.

Then finally I realised it's the URI I configured is not HTTP variant.

I was trying to push to SSH URI of my Git with HTTP configuration.

Check your URL in

Git Perspective > Remotes > Origin > Configure Fetch > Change > Make sure the prtocal is HTTPS and the URL is https version.

I could use console to push/pull the repositories, but no in eclipse. In my case, eclipse seems can't read my SSH private key, my key started with:

-----BEGIN OPENSSH PRIVATE KEY-----

And I noticed my colleague's key started with:

-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED

I think currently eclipse can't take this new kind of key (OPENSSH PRIVATE KEY).

I solved it by: Regenerate your ssh key by using command:

ssh-keygen -m PEM -t rsa -b 2048

This will use the old way to generate the key: so it will starts with the headers:

-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED

see more information on:

https://github.com/duplicati/duplicati/issues/3360

Then you can load the key again in eclilpse by using Preferences -> Network connections -> SSH2, click "Add Private Key" (still select your private key, even you already see the name in the list of private keys, because eclipse has to reload it)