1

I am unable to git clone my application created on openshift free hosting gears on my local machine. I have set up the 'rhc' tools on my machine using the following link

https://developers.openshift.com/managing-your-applications/client-tools.html

It's strange that the public key is updated on the server and I can see a private key on my machine. However when I try to do git clone it gives the below mentioned error.

Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
SanketR
  • 1,182
  • 14
  • 35

1 Answers1

0

Depending on your OS, make sure HOME is correctly defined (it is not by default on Windows)

rhc and git look after the public/private id_rsa(.pub) keys in %HOME%\.ssh

The OP sanketr confirms it is a ssh key issue, used on Ubuntu with sudo (I comment that changes $HOME to /root):

It was not working for me earlier as the keys were not copied correctly inside the root/.ssh folder.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • How do i check it in Ubuntu? – SanketR Jul 03 '16 at 05:27
  • @SanketR Check the content of $HOME/.ssh, and its chmod (600 for the files, not writable for the folder) – VonC Jul 03 '16 at 05:37
  • I checked it and it has id_rsa and id_rsa.pub files inside it. I have also set the permissions to 600 for the .ssh folder, but still the error persists – SanketR Jul 03 '16 at 05:44
  • @SanketR 600 are for files: see http://stackoverflow.com/a/13428529/6309 – VonC Jul 03 '16 at 05:50
  • It still persists. I am not sure if the problem is because I have installed rhc tools using sudo. Does it cause permission issues? – SanketR Jul 03 '16 at 16:32
  • Sudo is not a problem here – devprashant Jul 04 '16 at 01:02
  • @devprashant Not sure because in windows i use git bash and while writing rhc commands i can run them without using sudo and they work fine, however in Linux they give me error. – SanketR Jul 04 '16 at 04:14
  • @san but if you are using sudo, home changes to /root. Do you have the ssh keys in /root/.ssh? – VonC Jul 04 '16 at 04:16
  • @devprashant I don't have. Willl give a try by creating them at root. – SanketR Jul 04 '16 at 04:28
  • @devprashant It didn't help even after creating the keys at root. I just copy pasted the .ssh dir – SanketR Jul 04 '16 at 04:35
  • @devprashant Got it solved as per the suggestion provided by you. It was not working for me earlier as the keys were not copied correctly inside the root/.ssh folder. Thanks a lot mate... :) – SanketR Jul 04 '16 at 04:44
  • @SanketR Great! I have included the proper resolution in the answer for more visibility (since I was the one suggesting to copy the keys in /root/.ssh). – VonC Jul 04 '16 at 05:06
  • @vonc the credit is yours. SanketR mistakenly quoted me in comments. This comment is for clearification for proper thanks giving. – devprashant Jul 04 '16 at 06:10
  • @devprashant Thank you. No problem, let's wait for the OP's feedback. – VonC Jul 04 '16 at 06:46
  • @VonC Apologies. I mistakenly quoted devPrashant's name in my comments without noticing your name. Ofcourse the credit is yours VonC for showing me the light in dark... :) – SanketR Jul 04 '16 at 11:01