Permission denied (publickey,gssapi-keyex,gssapi-with-mic) on openshift
Asked Answered
S

14

37

I am having issues with committing changes to my gear. I have tried to run rhc setup, I also deleted my .ssh folder and executed rhc setup again but that also didnt work.

Not sure what changed but it worked couple of hours ago.

>git push -u <GEAR_NAME> master
Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists.

>git remote add devstage3 -f ssh://<GEAR_ID>@<GEAR_NAME>-<GEAR-DOMAIN>.rhcloud.com/~/git/<GEAR_DOMAIN>.git/ 

Also I have tried to start a different gear and commit to it but I am getting the same error:

Updating <GEAR_NAME>
The authenticity of host '<GEAR_NAME>-<GEAR-DOMAIN>.rhcloud.com (<GEAR_IP>)' can't be established.
RSA key fingerprint is <KEY_FINGERPRINT>.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '<GEAR_NAME>-<GEAR-DOMAIN>.rhcloud.com,<GEAR_IP>' (RSA) to the list of known hosts.
Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
error: Could not fetch <GEAR_NAME>
Shaia answered 3/2, 2014 at 0:21 Comment(7)
The problem is somewhere on the remote end. Are you sure the gear_id has read/write permissions to the folder? Also, is your key allowed access to the repository?Bub
How can I check it? I have just tried to clone from any of my gears and I am getting the same "Permission denied (publickey,gssapi-keyex,gssapi-with-mic)." errorShaia
I've never used rhcloud.com, but usually you need to add a public key for the GEAR_ID user in order to be able to fetch/clone a git repo via SSH. Did you do that? The error you're getting usually means your public key was rejected and therefore it could not continue reading the remote repo.Bub
If you don't have a .ssh/id_dsa AND a .ssh/id_rsa key files, rhc will will launch a wizard to create key files and upload the result to the server. So check also what you have on the web console.Responsible
@Responsible I have tried to execute rhc setup, I have deleted my <user>/.ssh folder and then executing rhc update. The problem remains.Shaia
What do your permissions look like in your .ssh folder?Exhaustion
@Dave Cassel : Hi sir, please help me for #58542104Escargot
S
18

Remove the keys: rhc sshkey-remove You can also delete them from the management console, by going to https://openshift.redhat.com/app/console/settings

Once done, upload the public key (copy the content of your id_rsa.pub to management console) : https://openshift.redhat.com/app/console/keys/new

Save it. After this try to git clone and it should work for you.

Shaia answered 17/2, 2014 at 15:1 Comment(1)
Your solution along with the help of the following link helped me solve my problem. help.github.com/articles/generating-ssh-keysAves
M
25

if you are using Windows, you can try the following steps:

  1. look for your ssh public key usually you can find it at c:\\users\\YOUR_USERNAME\\.ssh

  2. copy your openshift public key to your git's ssh-key folder

    suppose we have git in d:\\git

    then we need to copy the public key from c:\\users\\YOUR_USERNAME\\.ssh to d:\\git\\.ssh

  3. try if it works

Maul answered 13/7, 2014 at 8:30 Comment(5)
Perfect, this was my problem on Windows. Solved!Entranceway
Mine too, worked perfectly! I wonder why the public key wasn't copied to git folder?Jail
sounds perfect boris :-)Viewing
I don't have .ssh folder in e:\\Git.. ?Pathy
it is not allowing to create .ssh folder.Pathy
S
18

Remove the keys: rhc sshkey-remove You can also delete them from the management console, by going to https://openshift.redhat.com/app/console/settings

Once done, upload the public key (copy the content of your id_rsa.pub to management console) : https://openshift.redhat.com/app/console/keys/new

Save it. After this try to git clone and it should work for you.

Shaia answered 17/2, 2014 at 15:1 Comment(1)
Your solution along with the help of the following link helped me solve my problem. help.github.com/articles/generating-ssh-keysAves
R
11

what worked for me was to generate the keys using Git Bash

ssh-keygen -t rsa -b 4096 -C "[email protected]"

and then add the key to ssh-agent as described here

https://help.github.com/articles/generating-a-new-ssh-key/

Ridenour answered 17/2, 2016 at 11:37 Comment(1)
You saved me a lifeShaefer
B
7

Had the same issue and wasted hours, I'm using centos 7. The following solved my problem.

On linux:

  1. "cd /home/your_username/.ssh"
  2. View "id_rsa.pub" and copy contents
  3. On openshift create a key from the UI and paste the contents from your "*.pub" file
  4. Save your new key
  5. Try reconnecting from your local machine

Hope the above helps. Note, on mac it worked from the word go only linux game me errors.

Bibliography answered 11/6, 2015 at 5:52 Comment(0)
M
3

I would also recommend trying to SSH in first. With SSH use the -vv flag to show more of the connection information. My guess is that SSH is trying to use a different key than what you uploaded to the server

Mealworm answered 3/2, 2014 at 21:37 Comment(5)
Can you elaborate more? SSH in Putty on windows works for me, but GIT does not with the same error as described above (permission denied). The public key locally in .ssh is similar to the remote key in the web console. This was made after rhc setup cmd.Musetta
Putty and OpenSSH use different keys so if git is using the OpenSSH client for it's ssh traffic then you need to make sure it is using the right keyMealworm
@Mealworm and how to make sure git is using the right key? since putty works without a problemRidenour
I am not an expert on this on windows. There is some special place git on windows put's it's SSH key and it is different from the putty keys. You need to find those keys and then add the public one to OpenShiftMealworm
@Mealworm , hi sir, please help me out for #58542104Escargot
M
1

please check if you have changed to another account.

i encountered this problem when my account changed to root.

I am using ubuntu.

I solved this problem by the following cmds

rm ~/.openshift/ -rf
rm ~/.ssh/* -rf
rhc setup

and i encountered the following error:

chmod: 更改".git/FETCH_HEAD" 的权限: 不允许的操作

solved by :

sudo chmod 777 .git/FETCH_HEAD

then:

git pull

got:

Already up-to-date.

everything goes find.

Monotony answered 3/4, 2014 at 4:55 Comment(0)
R
1

you have to check in ~/.ssh/ if exists a file id_rsa.pub and id_rsa if not you have to create it using openssh or if exists a file with extension .pub duplicate it and rename the copy as id_rsa.pub then do the same with id_rsa. this work with google compute engine. I've tried

Rickard answered 13/7, 2014 at 11:57 Comment(0)
A
1

Also make sure your ~/.ssh/id_rsa file has proper permissions required by rhc:

chmod 600 ~/.ssh/id_rsa
Abrade answered 1/6, 2016 at 16:3 Comment(0)
A
1

The following answer might be helpful. Add GSSAPIAuthentication no into .ssh/config

$ cat .ssh/config
Host *
  ServerAliveInterval 240
  GSSAPIAuthentication no
Attenweiler answered 9/2, 2018 at 19:56 Comment(0)
L
0

I fixed the problem by setting up proxy for ssh: ~/.ssh/config

ProxyCommand /bin/connect.exe -H proxy:8080 %h %p

Host rhcloud.com
User [email protected]
Port 22
Hostname rhcloud.com
IdentityFile "C:\users\username\.ssh\id_rsa"
TCPKeepAlive yes
IdentitiesOnly yes

SSH in git behind proxy on windows 7

My initial mistake was to use appname.rhcloud.com as Host or Hostname. And yes, adding your public key to OpenShift is also necessary.

Lilas answered 24/3, 2014 at 9:59 Comment(0)
T
0

I had Permission denied (publickey,gssapi-keyex,gssapi-with-mic)
when cloning with git clone ssh://<<repo_created_by_openshift>>.

App was created with Openshift's website, not with rhc app create.
My SSH key was ok, reimporting it to Openshift didn't help, nor did expiring sessions, and so on.
I didn't want to generate a new key.

What finally worked was using:
rhc git-clone -a <app_name>> instead of bare git clone <<repo_address>>.
You may have to expire sessions as well.

Thrown answered 13/9, 2016 at 8:20 Comment(0)
H
0

On Windows, removing host record in Windows Credential manager helped me. After it, git became require password of my ssh key.

Hierocracy answered 23/4, 2021 at 17:51 Comment(0)
P
0

In my own case I had to copy my local public key at C:\Users{PCUserName}.ssh to my server SSH Access under manage keys I imported the public key.

Punk answered 11/10, 2022 at 14:27 Comment(0)
M
0

Make sure you are in the right environment with right ssh key.

Midkiff answered 5/3 at 0:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.