Git over SSH with username/password doesn't work after password change

Dear Forum,

for our current project, we use a central, self-hosted, Git repository for a Ruby on Rails application. That Git repository is requested over SSH with username/password.
I once forgot my password, so is was resetted on the server, but RubyMine doesn't request it. No operation works (fetch, pull, push) :(
I'm using the built-in SSH executable.
This is from the RubyMine log:

2012-09-19 14:42:06,225 [  33259]   INFO -   #git4idea.push.GitPushDialog - collectInfoToPush...
2012-09-19 14:42:06,363 [  33397]   INFO -   git4idea.commands.GitHandler - cd D:\Sources\Rails\order_pay\src_op
2012-09-19 14:42:06,363 [  33397]   INFO -   git4idea.commands.GitHandler - "D:\Program Files (x86)\Git\bin\git.exe" log --max-count=5 happyhours --name-status --pretty=format:%x01%h%x02%H%x02%ct%x02%an%x02%at%x02%ae%x02%cn%x02%ce%x02%p%x02%d%x02%s%x02%b%x02%B%x03 --encoding=UTF-8 --full-history --sparse -- .
2012-09-19 14:42:06,410 [  33444]   INFO -   #git4idea.push.GitPushDialog - collectInfoToPush | Collected commits to push. Push spec: {D:\Sources\Rails\order_pay\src_op=GitRemote{myName='origin', myUrls=[ssh://pinto@5.9.70.78:/opt/git/src_op.git], myPushUrls=[ssh://pinto@5.9.70.78:/opt/git/src_op.git], myFetchRefSpec='[+refs/heads/*:refs/remotes/origin/*]', myPushRefSpec='[+refs/heads/*:refs/remotes/origin/*]'} refs/heads/happyhours->refs/remotes/}, commits: 691560fb27af34f5df223413ced34529168
2012-09-19 14:42:09,783 [  36817]   INFO -   #git4idea.push.GitPushDialog - getPushInfo start
2012-09-19 14:42:09,783 [  36817]   INFO -   #git4idea.push.GitPushDialog - getPushInfo | refresh is needed, collecting...
2012-09-19 14:42:09,783 [  36817]   INFO -   #git4idea.push.GitPushDialog - collectInfoToPush...
2012-09-19 14:42:09,870 [  36904]   INFO -   git4idea.commands.GitHandler - cd D:\Sources\Rails\order_pay\src_op
2012-09-19 14:42:09,870 [  36904]   INFO -   git4idea.commands.GitHandler - "D:\Program Files (x86)\Git\bin\git.exe" log --max-count=5 happyhours --name-status --pretty=format:%x01%h%x02%H%x02%ct%x02%an%x02%at%x02%ae%x02%cn%x02%ce%x02%p%x02%d%x02%s%x02%b%x02%B%x03 --encoding=UTF-8 --full-history --sparse -- .
2012-09-19 14:42:09,913 [  36947]   INFO -   #git4idea.push.GitPushDialog - collectInfoToPush | Collected commits to push. Push spec: {D:\Sources\Rails\order_pay\src_op=GitRemote{myName='origin', myUrls=[ssh://pinto@5.9.70.78:/opt/git/src_op.git], myPushUrls=[ssh://pinto@5.9.70.78:/opt/git/src_op.git], myFetchRefSpec='[+refs/heads/*:refs/remotes/origin/*]', myPushRefSpec='[+refs/heads/*:refs/remotes/origin/*]'} refs/heads/happyhours->refs/remotes/origin/happyhours}, commits: 691560fb27af34f5df223413ced34529168
2012-09-19 14:42:09,914 [  36948]   INFO -   #git4idea.push.GitPushDialog - getPushInfo | selectedCommits: 691560fb27af34f5df223413ced34529168
2012-09-19 14:42:09,921 [  36955]   INFO -   git4idea.commands.GitHandler - cd D:\Sources\Rails\order_pay\src_op
2012-09-19 14:42:09,921 [  36955]   INFO -   git4idea.commands.GitHandler - "D:\Program Files (x86)\Git\bin\git.exe" push origin happyhours:happyhours
2012-09-19 14:53:38,050 [ 725084]   INFO -   git4idea.commands.GitHandler - cd D:\Sources\Rails\order_pay\src_op
2012-09-19 14:53:38,050 [ 725084]   INFO -   git4idea.commands.GitHandler - "D:\Program Files (x86)\Git\bin\git.exe" checkout master
2012-09-19 14:53:38,661 [ 725695]   INFO - a.repo.GitUntrackedFilesHolder - GitUntrackedFilesHolder: Index has changed, marking file://D:/Sources/Rails/order_pay/src_op recursively dirty
2012-09-19 14:53:49,863 [ 736897]   INFO -   git4idea.commands.GitHandler - cd D:\Sources\Rails\order_pay\src_op
2012-09-19 14:53:49,863 [ 736897]   INFO -   git4idea.commands.GitHandler - "D:\Program Files (x86)\Git\bin\git.exe" pull --no-stat -v --progress origin master
2012-09-19 14:54:02,578 [ 749612]   INFO -    #git4idea.update.GitFetcher - fetching D:\Sources\Rails\order_pay\src_op
2012-09-19 14:54:02,581 [ 749615]   INFO -   git4idea.commands.GitHandler - cd D:\Sources\Rails\order_pay\src_op
2012-09-19 14:54:02,581 [ 749615]   INFO -   git4idea.commands.GitHandler - "D:\Program Files (x86)\Git\bin\git.exe" fetch --prune origin
2012-09-19 14:54:05,054 [ 752088]   INFO -    #git4idea.update.GitFetcher - Error fetching: [com.intellij.openapi.vcs.VcsException: fatal: The remote end hung up unexpectedly]


I'm using RubyMine 4.5.4 with git 1.7.11.msysgit.1 on Windows 7 x64

Any ideas?

Yours
Raul

12 comments

I am a noob, but in my experience of setting up remote (lniux) servers, I always disable password logon on enabling SSH login (it seems standard practice). With that in mind, have you tried just using your username and leaving the password blank? Long shot, but just a thought :) The idea is that the key should confirm your identity?

0

Hi Kevin,

as far as I know, you can't save an SSH password. When I use the command line tool of git, I always have to enter the password. But I'm not sure about RubyMine, because it doesn't work for a while and I forgot :(
Anyway, I woudln't know, where to enter the password so I can't leave that blank :)

Yours
Raul

0

Hm, ok, now we have prublic/private key authentication and I added the key to my .ssh directory in my users home directory. Git commandline works without problem. But RubyMine throws an Exception:

java.io.IOException: There was a problem while connecting to x.xx.xxx.xxxx::22
     at com.trilead.ssh2.Connection.connect(Connection.java:791)
     at com.trilead.ssh2.Connection.connect(Connection.java:577)
     at org.jetbrains.git4idea.ssh.SSHMain.start(SSHMain.java:155)
     at org.jetbrains.git4idea.ssh.SSHMain.main(SSHMain.java:136)
Caused by: java.net.UnknownHostException: x.xx.xxx.xxxx:
     at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
     at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:849)
     at java.net.InetAddress.getAddressFromNameService(InetAddress.java:1202)
     at java.net.InetAddress.getAllByName0(InetAddress.java:1153)
     at java.net.InetAddress.getAllByName(InetAddress.java:1083)
     at java.net.InetAddress.getAllByName(InetAddress.java:1019)
     at java.net.InetAddress.getByName(InetAddress.java:969)
     at com.trilead.ssh2.transport.TransportManager.createInetAddress(TransportManager.java:165)
     at com.trilead.ssh2.transport.TransportManager.establishConnection(TransportManager.java:340)
     at com.trilead.ssh2.transport.TransportManager.initialize(TransportManager.java:449)
     at com.trilead.ssh2.Connection.connect(Connection.java:731)
     ... 3 more
fatal: The remote end hung up unexpectedly


(I changed the IP adress to x.xx.xxx.xxxx in this console paste)

0

[quote]Caused by: java.net.UnknownHostException:[/quote]

Something isn't right about your keys and it cannot authenticate. Do you have a .ssh (hidden) folder in your home directory and have you added (either manually or using.... um I forget but you can google) your Id_rsa (or is it id_rsa.pub?) to the list of keys? I mean adding one part of your key to the machine you are trying to connect to and the other in your .ssh folder.

Sorry, there are probably people a lot more Linux experienced than me. I have done it multiple times, I have to set keys up every time I re-provision one of my VPS's, but I cannot remember the syntax as I am not primarily a linux user.

You can find a good guide in the basic and security setup section of the Linode library (anyone can access) at Linode.com.

0

Hi Kevin,

thank you for your answer!
As I said, git commandline works well. The correct key therefore must be on the server and in my .ssh directory in my home directory.
I just converted this private key to Putty so TortoiseGit does work now as well.
I just didn't see a way to add the key to ruby mine, do you know, where exactly I can set the key for this Git repository?

I'm using win7 btw.

Yours
Raul

0

I use Win 7x64 as well sometimes, though mostly a Ubuntu 12.04.1 VM with Rubymine/Git etc installe there (it's so much easier than running into constant windows 7 problems I found in the end). Anyway...

In Windows 7:

C:/Users/[YOUR USER]/.ssh is where git on windows stores it's keys.

But... I think I have an answer for you! :)

Rubymine uses a Java ssh which is not aware of your keys. Here is a post in Stack Exchange about it:

http://stackoverflow.com/questions/9582912/setup-git-over-ssh-in-rubymine-on-windows

That tells you what to do. You will need pageant running (putty program in the putty folder, can get from menu) if you use a passphrase as well as SSH. Just follow the instructions on the link I gave you.

Hopefully this will solve your problem, I think this is the reason for sure why it is not working.

0

Hi Kevin,

following the link you gave me, I only see one question and one answer. The questioner says, no way of getting it done (as I see it), the answerer only says not to use the native SSH client when using passphrases.
I don't use a passphrase so that should be fine. But if I change to native, and try to do a git Fetch, my RubyMine says "Fetching..." and doesn't stop :(

Furthermore my stacktrace says "UnknownHostException" and not "Authentication failed".
I downloaded pageant.exe from puttys homepage, executed it and it said "already running". So I checked RubyMine but didn't find anything about pageant. I checked the systray and there was a pageant icon. I opened it and it had my key in it. So I restarted RubyMine, but still, same UnknownHostException.

Perhaps the problem is, that my git has the remote IP address and not a DNS name? Perhaps RubyMine tries to make a DNS lookup wich doesn't work and doesn't try to connect then?

Yours
Raul

0

Have you added the host in git and setup git with your details? (check git 101 for this). Also, you need to add the repo address:

cd [existing_git_repo]
git remote add origin git@github.com:caius/foo.git [replace git@github... with git@[IP ADDRESS]:[USER]/[nameofrepo.git]
git push origin master

IP adddress should be fine. If you have a name then better to use it, but it will just resolve the same anyway.
0

Hi Kevin,

what I see from your suggestion is to add a remote repository.
As I mentioned before, git works using the command line and TortoiseGit. So my remote is correctly configured for the remote repository. It's only RubyMine making problems.

Your
Raul

0

At this stage then I would file a support request. I can't think of anything else it might be. It just worked for me on both Windows and Linux.

One more thing you could try is check if you can connect to github. I'm sure you have an account, just make a fake project and check it's working. IF it is then it has to be something to do with the way your repository is setup or you have the wrong IP address, or it's being firewalled. That's all I can think of I'm afraid.

Good luck :) Please let us know when you find out what it is - I am really curious now.

0

Hi Kevin,

I more or less have accepted that it doesn't work. I also don't have a github account and thought I'd just insert the issue to the issue tracker system, here's the link: http://youtrack.jetbrains.com/issue/RUBY-12200

Let's see, what happens.

Yours
Raul

0

As Kevin said, Rubymine uses a different binary for SSH and it might not be aware of your keys. I had the exact same issue you have so I told Rubymine to use the native SSH executable and that worked!

  1. go to Preferences-> Version Control-> Git
  2. set SSH executable to Native
  3. click Ok
  4. Try pushing again.

In my case it was pushing to Heroku but it did the trick. Good luck.
0

Please sign in to leave a comment.