git openshift 上的权限被拒绝(publickey、gssapi-keyex、gssapi-with-mic)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21518074/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 17:39:48  来源:igfitidea点击:

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

gitopenshiftgit-pushpublic-key

提问by special0ne

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.

我在对我的装备进行更改时遇到问题。我试图运行 rhc setup,我也删除了我的 .ssh 文件夹并再次执行 rhc setup 但这也没有奏效。

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>

采纳答案by special0ne

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

删除密钥:rhc sshkey-remove 您也可以通过访问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

完成后,上传公钥(将您的 id_rsa.pub 的内容复制到管理控制台):https: //openshift.redhat.com/app/console/keys/new

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

保存。在此尝试之后git clone,它应该对您有用。

回答by boris1993

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

如果您使用的是 Windows,您可以尝试以下步骤:

  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\\.sshto d:\\git\\.ssh

  3. try if it works

  1. 查找您的 ssh 公钥,通常您可以在以下位置找到它 c:\\users\\YOUR_USERNAME\\.ssh

  2. 将您的 openshift 公钥复制到您的 git 的 ssh-key 文件夹中

    假设我们有 git d:\\git

    然后我们需要将公钥复制c:\\users\\YOUR_USERNAME\\.sshd:\\git\\.ssh

  3. 试试看是否有效

回答by azerafati

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

对我有用的是使用Git Bash生成密钥

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

and then add the key to ssh-agentas described here

然后ssh-agent按此处所述添加密钥

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

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

回答by Rodrigo Rubio

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

有同样的问题并浪费了时间,我使用的是 centos 7。以下解决了我的问题。

On linux:

在 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
  1. “cd /home/your_username/.ssh”
  2. 查看“id_rsa.pub”并复制内容
  3. 在 openshift 上从 UI 创建一个密钥并粘贴“*.pub”文件中的内容
  4. 保存您的新密钥
  5. 尝试从本地机器重新连接

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

希望以上有帮助。请注意,在 mac 上,它从 go only linux game me errors 这个词开始工作。

回答by TheSteve0

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

我还建议先尝试 SSH。对于 SSH,使用 -vv 标志来显示更多连接信息。我的猜测是 SSH 正在尝试使用与您上传到服务器的密钥不同的密钥

回答by TheSteve0

please check if you have changed to another account.

请检查您是否已更改为其他帐户。

i encountered this problem when my account changed to root.

当我的帐户更改为 root 时,我遇到了这个问题。

I am using ubuntu.

我正在使用 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.

一切去寻找。

回答by user3784659

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

你必须检查 ~/.ssh/ 如果存在一个文件 id_rsa.pub 和 id_rsa 如果没有你必须使用 openssh 创建它或者如果存在一个扩展名为 .pub 的文件复制它并将副本重命名为 id_rsa.pub 然后做与 id_rsa 相同。这项工作与谷歌计算引擎。我试过了

回答by caot

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

以下答案可能会有所帮助。添加GSSAPIAuthentication no.ssh/config

$ cat .ssh/config
Host *
  ServerAliveInterval 240
  GSSAPIAuthentication no

回答by aesede

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

还要确保您的 ~/.ssh/id_rsa 文件具有 rhc 所需的适当权限:

chmod 600 ~/.ssh/id_rsa

回答by vucalur

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

Permission denied (publickey,gssapi-keyex,gssapi-with-mic)
在与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.

应用程序是使用 Openshift 的网站创建的,而不是使用rhc app create.
我的 SSH 密钥没问题,将其重新导入 Openshift 没有帮助,会话过期等也没有帮助。
我不想生成新密钥。

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.

最终起作用的是 using:
rhc git-clone -a <app_name>>而不是 bare git clone <<repo_address>>
您可能还必须使会话过期。