Aptana and Git through SSH, the big problem

Published on Monday, 18 November 2013 12:01

We all know that despite the fact that Aptana is one of the best Eclipse based IDEs out there, it has lot of bugs. Part of these bugs are because of multi-platform nature of this application and most of them are not very annoying, but this one.

If you try to use Aptana with Git (over SSH) using "Keys" for authentication, you usually receive an authentication fail error (^). Which is clearly some sort of bug because Aptana supposed to be more integrated with Git and show us at least some sort of dialog box for selecting a "Key" file.

Also Aptana's SSH settings makes no difference in this case (General->Network Connection->SSH2). At least I failed to achieve any success using them. Even "Key Management" tab reset every time I open it.

Worse than all of this is the fact that there is not a lot of success stories in Internet either. The only way that people suggest to each other to solve this problem is to use HTTPS URL of git when using GitHub. Which was not an option for me as I had my own private GIT server with no HTTPS support.

So I thought for finding the problem, first I need to analyze the program and see what it does. At lease at file level if not trying debug it.

And fortunately using "Process Monitor" to understand OpenSSH behavior I have found some good information about the problem. So let me first introduce "Process Monitor" to you and show you how I configured and then used it.


"Process Monitor" is part of "Sysinternals Suites" and as far as I knew it is the successor of old "Filemon" which is famous enough. You can download it from Microsoft Website.

First step is to configure "Filters" so it only capture events from ssh.exe program, which is the main executable file of OpenSSH.

Then I enabled capturing of only "File System" events using Process Monitor toolbar.
 

Now let see where it expect our key to be. The only thing we need to do now is to ask Aptana to push contents to Remote Repo and see what happens at file level.

You can see two interesting things in Process Monitor after doing so, one of them is:

 


As you can clearly see in the above image, ssh.exe try to read id_rsa and identity.pub files from the .ssh folder. So lets simply see what happens if we copy our key there and rename it to id_rsa.

Trying to push again using Aptana and we get:

Success! At last! And it was very easy!!

Yet there is still one problem; what if you have more than one Key? Remember when I said there is two interesting entry in Process Monitor? Here is other one:

This clearly shows that ssh.exe check for "config" file as well. Config file is very useful in the situation I described above. Using this file we can tell ssh.exe to use which one of the keys for each host. For example below example shows how to force it to use "myprivategithost" file as key when connecting to myprivategithost.com.

 

You can read more about config files at Nerderati.

I hope this short and simple tip/walkthrough can save a little time for some of you who got headache working with Aptana and Git.