Search code examples
ruby-on-railsrubyopenshiftopenshift-client-tools

Error executing rhc setup - An unexpected error occurred: invalid character at "<!doctype "


After Executing > rhc setup and then entering my hostname i always get this error message

enter image description here

Steps that i've done:

1- installed Ruby 1.9.3

2- installed rhc using gem gem install rhc

3- Executed > rhc setup


Solution

  • It seems that this is some kind of bug.

    But, there is another way to manually generate SSH public-private key pairs and upload them to OpenShift

    1- Generate new SSH keys

    C:\> ssh-keygen
    

    It will ask you where to save the key files just press "Enter" -> this will generate key-pairs with name "id_rsa" in "C:\Users\YOU\.ssh" also Press Enter when asked for passphrase to keep it empty

    2- Upload you Public Key to OpenShift

    C:/>rhc sshkey add id_rsa C:\Users\YOU\.ssh\id_rsa.pub
    

    It will then ask you for your credentials on OpenShift, once done your public key is now uploaded to OpenShift

    3- Configuring SSH to use the Generated private key when connecting to your APP

    a- Make sure you have an environment variable "HOME" pointing to "C:/Users/YOU/.ssh", if not create one

    b- open "C:/Users/YOU/.ssh/" if you find config file open it , if not create one by running the following command:

    touch config
    

    Now add the following lines to config file:

    Host ChooseAName
     HostName APPName-NameSpace.rhcloud.com
     IdentityFile ~\.ssh\id_rsa.pub
    

    save and close

    4- Now Connecting to your App:

    First, Get the command that enables you to connect remotely to your app on rhcloud server , you can get it using the OpenShift web console

    enter image description here

    enter that to you command line and you will be connected trough a secure shell to you APP on rhcloud