Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit / JGit » Using SSL certificates with eGit(Configure eGit to work with an existing functioning SSH connection to a repository)
Using SSL certificates with eGit [message #1822019] Tue, 25 February 2020 21:40 Go to next message
David Lovell is currently offline David LovellFriend
Messages: 2
Registered: February 2020
Junior Member
I cannot get eGit to work using SSH for push/pull with a GitLab repository. I've been using Git Bash to do all push/pull/fetch operations at the command line. That works fine. I set that up by creating an SSH key and pasting it into the web UI of GitLab. All I had to do locally was use the SSH URL for the remote and now it works without asking for a password. I just push/pull/fetch and it works.

The URL looks like this:
ssh://gitlab@ourgitlabserver.com/myuserid/my--repository--name.git

I cannot get this working with Eclipse eGit. I've found 3 sites online with instructions but all of them are missing a few steps (like how to authenticate). None answer the question I have (use SSL).

I can tell Eclipse to use SSH - same URL as what works with command line - but when I try to do a fetch it asks for a password. I have no idea what password it could possibly want. I've tried my password and that does not work. Besides, I thought the whole point of using SSL certificates was to NOT enter your password every time? Why can't Eclipse just use SSL and do what the command line is doing?

What am I missing? I have no idea what a next step would be. Ideas?



Re: Using SSL certificates with eGit [message #1822141 is a reply to message #1822019] Thu, 27 February 2020 22:13 Go to previous messageGo to next message
Thomas Wolf is currently offline Thomas WolfFriend
Messages: 374
Registered: August 2016
Senior Member
SSL has nothing to do with SSH.

Typically, on gitlab you connect as user "git", and the server figures out who you are based on the SSH key you use.


  1. Double check your connection URL. What if you replace "gitlab@" by "git@"?
  2. Copy the SSH URI from the Gitlab Web UI.
  3. Check what your ~/.ssh/config says.
  4. Are you on Windows? Check that Eclipse and Git Bash use the same ~/.ssh/config. Check the SSH2 Home setting in the Eclipse preferences, in the SSH2 preference page. Check that the environment variable HOME is set correctly.
  5. Check what the URI for the configured remote in your clone actually is.

Re: Using SSL certificates with eGit [message #1822174 is a reply to message #1822141] Fri, 28 February 2020 16:35 Go to previous messageGo to next message
David Lovell is currently offline David LovellFriend
Messages: 2
Registered: February 2020
Junior Member
Good point. Replace SSL with SSH in everything in this post.

1) in a git bash window I enter:
git remote --verbose

it shows me the URL for origin (gitlab) which exactly matches what I cut-n-pasted from gitlab when I set it up. It works for push/pull/fetch - does not ask for password. Works.

In Eclipse - Git Repositories view - expand origin - the url it shows for push and pull exactly matches the above and was already there when I added this view. If I change this to git@ on the command line using git remote set-url origin it changes for the Git Repositories view in Eclipse also. These configurations are in git not in git bash or Eclipse right?
I changed it to git@ and it started asking me for a password on the command line as well. It effectively broke command line (git bash) in the same way Eclipse is broken.

Maybe Eclipse does not understand the gitlab user?

2) I do not know any other way of setting this up

3) where is this? there is no such directory on my computer. I have public and private keys and known_hosts - no config file - googled it - I have id_rsa - so this is SSH v1 - but in Eclipse when I go to Window ... Preferences ... Network Connections it has SSH2 configuration. It lists id_rsa and id_dsa as private key options so it leads me to believe it still supports SSH v1 ? It is pointing to the directory that contains my public and private keys. should I create an empty config file here? tried it nothing changes.

4) I really should have mentioned that this is a Windows 10 pc - i'm using WSL to run a Debian app that has all the apache/ssh/postgresql processes running on them. git bash is just a powershell with a bash facelift it runs on windows. Eclipse is on windows too. i'm managing source with git on the windows side the app VM reads source thru a symlink. i'm considering this to be a purely windows thing. $HOME points to my user directory.

5) I guess you mean git remote --verbose ? yes the URL matches what I cut-n-pasted from gitlab when I set this up.

Could this be an issue with E-git not understanding that for this site it uses gitlab@ and not git@ ?? Maybe that's why it wants a password?

Is it an SSH v1 versus SSH2 thing?

Thanks for the insight. Going over this checklist has made me feel better that i'm not missing something obvious but worse in that there does not seem to be an easy answer. But I do have Git Bash as a solution.

Thanks!



Re: Using SSL certificates with eGit [message #1822199 is a reply to message #1822174] Sat, 29 February 2020 17:34 Go to previous message
Thomas Wolf is currently offline Thomas WolfFriend
Messages: 374
Registered: August 2016
Senior Member
So it looks as if your gitlab server really is configured to use "gitlab" as user name. Just wanted to make sure that's really the case; it's a bit unusual and it wouldn't have been the first time that some copy-paste error threw analysis off. Recently there was someone who complained about SSH, and in the end it turned out he used an https URI.

The user name doesn't matter at all for EGit.

Re (3): So there is a "%HOME%\.ssh" directory, and it does contain your id_rsa and id_rsa.pub files. There is no config file, which is OK. Eclipses SSH2_HOME preference points to the same directory.

Which SSH client library do you use in Eclipse? Check in Eclipse under Preferences->Team->Git; you can choose between "Jsch" and "Apache MINA sshd". Does the problem occur with both?

If you don't see any option to choose on that preference page, then you are using an old EGit version. Upgrade to EGit nightly from the update site https://download.eclipse.org/egit/updates-nightly .

Which EGit version are you using anyway? If it's older than 5.6, I'd recommend upgrading to EGit nightly in any case.

It could also be a problem with the private key file itself. Perhaps it's in some format that Eclipse doesn't understand. Did you generate that key recently? If so, how? Does the key have a passphrase? (The way ssh-keygen writes private keys has changed a while ago, and only a recent EGit version will be able to read such keys.)

And no, it's not a SSHv1 vs. SSHv2 problem. EGit uses SSHv2. (I think nowadays almost everyone and everything uses that, only some embedded devices still have old SSHv1 servers.)
Previous Topic:How to disable Scroll to Selection in Git Repositories view
Next Topic:Unable to install eGit with RDI Version: 9.6.0.6
Goto Forum:
  


Current Time: Sun Jun 20 04:13:28 GMT 2021

Powered by FUDForum. Page generated in 0.02007 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top