6

I want view my openshift application log in my cmd. I did try :
rhc ssh appname

that time i am getting:

No system SSH available. Please use the --ssh option to specify the path to your SSH executable, or install SSH.

My system have already ssh key.so how can i solve that problem?

nmkkannan
  • 1,261
  • 4
  • 27
  • 49
  • 1
    It doesn't complain about ssh *keys*, but about the lack of the *executable* ssh. Do you have it in your PATH? – VonC Nov 26 '14 at 07:51
  • My ssh file path:"C:\Users\admin\.ssh" – nmkkannan Nov 26 '14 at 07:52
  • This folder contain three files. id_rsa.pub,id_rsa,known_hosts – nmkkannan Nov 26 '14 at 07:53
  • That is not an executable, just the folder which contains ssh-related files (keys, config, authorized_keys, known_hosts, ...). I am talking about `ssh.exe`. It should be included in your msysgit distribution. You need to add it to your `%PATH%`. – VonC Nov 26 '14 at 07:54
  • I did try to set ssh path using rhc command :rhc ssh -ssh "C:\Users\admin\.ssh" -a appname – nmkkannan Nov 26 '14 at 07:54
  • `"C:\Users\admin\.ssh"` is *not* the path of `ssh.exe`. – VonC Nov 26 '14 at 07:55
  • I got it your point now i try this? – nmkkannan Nov 26 '14 at 07:55
  • I did search ssh.exe in my computer but not found.How can install ssh.exe in my computer. – nmkkannan Nov 26 '14 at 08:04
  • Simply install Git (unzip https://github.com/msysgit/msysgit/releases/download/Git-1.9.4-preview20140929/PortableGit-1.9.4-preview20140929.7z anywhere you want). ssh.exe is included in it. – VonC Nov 26 '14 at 08:09

5 Answers5

11

If you installed Git for Windows1, then you can try something similar to:

rhc ssh --ssh C:\PROGRA~1\Git\usr\bin\ssh.exe -a <appname>

e.g.

rhc ssh --ssh C:\PROGRA~1\Git\usr\bin\ssh.exe -a myawesomeapp

Notes

  1. See https://git-scm.com/download/win or https://git-for-windows.github.io/
Community
  • 1
  • 1
Paul Vargas
  • 41,222
  • 15
  • 102
  • 148
6

You need to make sure:

  • you are in a cmd session where HOME is define (type set HOME to check its value: it must be C:\Users\yourLogin, because ssh needs to look for keys in %HOME%\.ssh)
  • your ssh.exe parent folder is referenced in the %PATH%, or you can type:

    rhc ssh -ssh "c:\prgs\git\PortableGit-2.8.3-64-bit\usr\bin\" -a appname
    

Replace c:\prgs\git\PortableGit-2.8.3-64-bit with the actual installation path of your Git for Windows.

The easiest solution is to add the git\usr\bin folder (which includes ssh.exe) to the PATH environment variable.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I am trying : rhc ssh --ssh "C:\Program Files (x86)\Git\bin" -a appname but i get message:SSH executable 'C:\Program' does not exist. – nmkkannan Nov 26 '14 at 08:18
  • Unzip Git in a path without any space in it. That will be easier. – VonC Nov 26 '14 at 08:18
  • I did try this: rhc ssh --ssh "C:\ProgramFiles(x86)\Git\bin" -a appname but i get same error.so i will try msysgit. – nmkkannan Nov 26 '14 at 08:25
  • I mean, unzip it in a different path, without space. I suspect "`C:\ProgramFiles(x86)`" doesn't exist. You can use any path you want: `c:\git` for instance. – VonC Nov 26 '14 at 08:26
  • @nmkkannan maybe it requires the full path to the exe, not its parent folder. Can you try: `rhc ssh -ssh "c:\git\bin\ssh.exe" -a appname` (replace '`c:\git`' with the path where you unzip git) – VonC Nov 26 '14 at 09:56
  • I am adding environment variable HOME ="git_path" without bin folder and path ="***';%HOME%\bin" It's working fine. thanks for helping.. – nmkkannan Nov 26 '14 at 14:29
  • @nmkkannan Great. I have completed the answer accordingly. – VonC Nov 26 '14 at 14:32
2

If you are not interested in adding your git path to PATH you will need to use a 8.3 style path because rhc can't seem to handle spaces in the path.

  • For x86 versions of git use rhc ssh myapp --ssh C:\Progra~2\Git\usr\bin\ssh.exe
  • For x64 versions of git use rhc ssh myapp --ssh "C:\Progra~1\Git\usr\bin\ssh.exe

If you leave the spaces like C:\Users\me>rhc ssh myapp --ssh "C:\Program Files (x86)\Git\usr\bin\ssh.exe"

You will get the following error:

RSA 1024 bit CA certificates are loaded due to old openssl compatibility
Connecting to my0apps0guid@myapp-me.rhcloud.com ...
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rhc-1.38.4/lib/rhc/commands/ssh.rb:49:in 'exec': No such file or directory - C:\Prog
ram (Errno::ENOENT)
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rhc-1.38.4/lib/rhc/commands/ssh.rb:49:in 'run'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rhc-1.38.4/lib/rhc/commands.rb:294:in 'execute'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rhc-1.38.4/lib/rhc/commands.rb:285:in 'block (3 levels) in to_commander'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/commander-4.2.1/lib/commander/command.rb:180:in 'call'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/commander-4.2.1/lib/commander/command.rb:180:in 'call'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/commander-4.2.1/lib/commander/command.rb:155:in 'run'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/commander-4.2.1/lib/commander/runner.rb:421:in 'run_active_command'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rhc-1.38.4/lib/rhc/command_runner.rb:72:in 'run!'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/commander-4.2.1/lib/commander/delegates.rb:12:in 'run!'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rhc-1.38.4/lib/rhc/cli.rb:37:in 'start'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rhc-1.38.4/bin/rhc:20:in '<top (required)>'
    from C:/Ruby193/bin/rhc:23:in 'load'
    from C:/Ruby193/bin/rhc:23:in '<main>'
Matt
  • 74,352
  • 26
  • 153
  • 180
0

Install 'SSH' client like Cygwin.

A very interesting Tutorial is->>> nawab-how-to-install-ssh

bondkn
  • 420
  • 5
  • 11
0

You may want to first got to Openshift Web Console >> Settings and delete the exiting keys. Then run rhc setup in command line. Then try rhc ssh -a yourApp --ssh C:\PROGRA~1\Git\usr\bin\ssh.exe. This is what worked for me so am sharing this answer. Hope this helps. Good Luck.

Aakash
  • 21,375
  • 7
  • 100
  • 81