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

问题描述 投票:0回答:14

我在更改装备时遇到问题。我尝试运行 rhc setup,我还删除了 .ssh 文件夹并再次执行 rhc setup,但这也不起作用。

不确定发生了什么变化,但几个小时前就起作用了。

>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/ 

我也尝试启动不同的装备并承诺它,但我遇到了同样的错误:

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>
git openshift git-push public-key
14个回答
25
投票

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

  1. 查找您的 ssh 公钥 通常你可以在

    c:\\users\\YOUR_USERNAME\\.ssh

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

    假设我们有 git

    d:\\git

    然后我们需要将公钥从

    c:\\users\\YOUR_USERNAME\\.ssh
    复制到
    d:\\git\\.ssh

  4. 尝试一下是否有效


18
投票

删除密钥:rhc sshkey-remove 您还可以通过访问 https://openshift.redhat.com/app/console/settings

从管理控制台删除它们

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

保存。之后尝试

git clone
,它应该对你有用。


11
投票

对我有用的是使用 Git Bash

生成密钥
ssh-keygen -t rsa -b 4096 -C "[email protected]"

然后按照此处所述将密钥添加到

ssh-agent

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


7
投票

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

在 Linux 上:

  1. “cd /home/你的用户名/.ssh”
  2. 查看“id_rsa.pub”并复制内容
  3. 在 openshift 上从 UI 创建密钥并粘贴“*.pub”文件中的内容
  4. 保存您的新密钥
  5. 尝试从本地计算机重新连接

希望以上内容对您有所帮助。请注意,在 mac 上,它仅在 linux 游戏错误中起作用。


3
投票

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


1
投票

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

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

我使用的是ubuntu。

我通过以下命令解决了这个问题

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

我遇到了以下错误:

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

已解决:

sudo chmod 777 .git/FETCH_HEAD

然后:

git pull

得到:

Already up-to-date.

一切都会找到。


1
投票

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


1
投票

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

chmod 600 ~/.ssh/id_rsa

1
投票

以下答案可能会有所帮助。将

GSSAPIAuthentication no
添加到
.ssh/config

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

0
投票

我通过设置 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

Windows 7 上代理后面的 git 中的 SSH

我最初的错误是使用 appname.rhcloud.com 作为主机或主机名。是的,将您的公钥添加到 OpenShift 也是必要的。


0
投票

我有

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

使用
git clone ssh://<<repo_created_by_openshift>>
进行克隆时。

应用程序是使用 Openshift 网站创建的,而不是使用

rhc app create

我的 SSH 密钥没问题,将其重新导入 Openshift 没有帮助,过期会话也没有帮助,等等。
我不想生成新密钥。

最终起作用的是使用:

rhc git-clone -a <app_name>>
而不是裸露的
git clone <<repo_address>>

您可能还必须使会话过期。


0
投票

在 Windows 上,删除 Windows 凭据管理器中的主机记录对我很有帮助。之后,git 变得需要我的 ssh 密钥的密码。


0
投票

就我自己而言,我必须将 C:\Users{PCUserName}.ssh 中的本地公钥复制到我导入公钥的管理密钥下的服务器 SSH 访问。


0
投票

确保您处于正确的环境中并拥有正确的 ssh 密钥。

© www.soinside.com 2019 - 2024. All rights reserved.