为什么上限部署会拒绝许可(公钥)?

发布于 2024-12-13 06:32:56 字数 3767 浏览 2 评论 0原文

好吧,我对某些事情感到困惑...我可以很好地提交到我的 github 存储库,但是当我尝试从本地文件夹到临时服务器进行 cap 部署 时,我得到 < code>权限被拒绝(公钥)。

如果我运行ssh [电子邮件受保护] 我实际上收到错误 PTY 分配请求在通道 0 上失败

所以这里出了问题。

如果我运行 ssh -vT [电子邮件受保护] 我得到:

OpenSSH_5.6p1, OpenSSL 0.9.8r 8 Feb 2011
debug1: Reading configuration data /Users/myuser/.ssh/config
debug1: Reading configuration data /etc/ssh_config
debug1: Applying options for *
debug1: Connecting to github.com [207.97.227.239] port 22.
debug1: Connection established.
debug1: identity file /Users/myuser/.ssh/id_rsa type 1
debug1: identity file /Users/myuser/.ssh/id_rsa-cert type -1
debug1: identity file /Users/myuser/.ssh/id_dsa type -1
debug1: identity file /Users/myuser/.ssh/id_dsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.1p1 Debian-5github2
debug1: match: OpenSSH_5.1p1 Debian-5github2 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.6
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'github.com' is known and matches the RSA host key.
debug1: Found key in /Users/myuser/.ssh/known_hosts:2
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/myuser/.ssh/github_rsa
debug1: Remote: Forced command: gerve technomad
debug1: Remote: Port forwarding disabled.
debug1: Remote: X11 forwarding disabled.
debug1: Remote: Agent forwarding disabled.
debug1: Remote: Pty allocation disabled.
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug1: Remote: Forced command: gerve technomad
debug1: Remote: Port forwarding disabled.
debug1: Remote: X11 forwarding disabled.
debug1: Remote: Agent forwarding disabled.
debug1: Remote: Pty allocation disabled.
debug1: Authentication succeeded (publickey).
Authenticated to github.com ([207.97.227.239]:22).
debug1: channel 0: new [client-session]
debug1: Requesting [email protected]
debug1: Entering interactive session.
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: client_input_channel_req: channel 0 rtype [email protected] reply 0
Hi technomad! You've successfully authenticated, but GitHub does not provide shell access.
debug1: channel 0: free: client-session, nchannels 1
Transferred: sent 2384, received 2888 bytes, in 0.1 seconds
Bytes per second: sent 42630.8, received 51643.3
debug1: Exit status 1

我的密钥位于 ~/.ssh 文件夹中,那么问题是什么,为什么我能够如果有关键问题就提交到存储库?

更新: 当我进入 .ssh 文件夹时,我确实注意到了一些事情。当我安装 Mac 版 Github 时创建了一个新的密钥对...为什么它不能只使用我现有的密钥对,我不知道。

Ok, I'm confused about something... I am able to commit to my github repository just fine, but when I try to do a cap deploy from my local folder to my staging server I get Permission denied (publickey).

If I run ssh [email protected] I actually get an error PTY allocation request failed on channel 0

So something here is wrong.

If I run ssh -vT [email protected] I get:

OpenSSH_5.6p1, OpenSSL 0.9.8r 8 Feb 2011
debug1: Reading configuration data /Users/myuser/.ssh/config
debug1: Reading configuration data /etc/ssh_config
debug1: Applying options for *
debug1: Connecting to github.com [207.97.227.239] port 22.
debug1: Connection established.
debug1: identity file /Users/myuser/.ssh/id_rsa type 1
debug1: identity file /Users/myuser/.ssh/id_rsa-cert type -1
debug1: identity file /Users/myuser/.ssh/id_dsa type -1
debug1: identity file /Users/myuser/.ssh/id_dsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.1p1 Debian-5github2
debug1: match: OpenSSH_5.1p1 Debian-5github2 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.6
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'github.com' is known and matches the RSA host key.
debug1: Found key in /Users/myuser/.ssh/known_hosts:2
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/myuser/.ssh/github_rsa
debug1: Remote: Forced command: gerve technomad
debug1: Remote: Port forwarding disabled.
debug1: Remote: X11 forwarding disabled.
debug1: Remote: Agent forwarding disabled.
debug1: Remote: Pty allocation disabled.
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug1: Remote: Forced command: gerve technomad
debug1: Remote: Port forwarding disabled.
debug1: Remote: X11 forwarding disabled.
debug1: Remote: Agent forwarding disabled.
debug1: Remote: Pty allocation disabled.
debug1: Authentication succeeded (publickey).
Authenticated to github.com ([207.97.227.239]:22).
debug1: channel 0: new [client-session]
debug1: Requesting [email protected]
debug1: Entering interactive session.
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: client_input_channel_req: channel 0 rtype [email protected] reply 0
Hi technomad! You've successfully authenticated, but GitHub does not provide shell access.
debug1: channel 0: free: client-session, nchannels 1
Transferred: sent 2384, received 2888 bytes, in 0.1 seconds
Bytes per second: sent 42630.8, received 51643.3
debug1: Exit status 1

My keys are in the ~/.ssh folder, so whats the issue, and why am i able to commit to the repository if there is a key issue??

UPDATE:
I did notice something when I went into my .ssh folder. There is a new keypair that was created when I installed Github for Mac... why couldn't it just use my existing keypair i don't know.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

无戏配角 2024-12-20 06:32:56

我必须执行以下操作:

   $ ssh-add -D   #remove existing identities
   $ ssh-agent    #copy the lines & run them
   $ ssh-add      #uses the output from above

I had to do the following:

   $ ssh-add -D   #remove existing identities
   $ ssh-agent    #copy the lines & run them
   $ ssh-add      #uses the output from above
狼性发作 2024-12-20 06:32:56

有时我会收到此错误,只需输入 $ ssh-add -k 即可添加我的身份,然后就可以了。不确定为什么会这样,或者为什么错误消息没有提示它,但它总是可以解决问题!

I get this error sometimes and I just type $ ssh-add -k to add my identity and then it works. Not sure exactly why this works or why the error message doesn't suggest it, but it always comes in to the rescue!

因为看清所以看轻 2024-12-20 06:32:56

我会确保你的登台服务器可以通过 ssh 访问 github。通过终端运行相同的命令“ssh -vT [email protected]”在您的临时服务器上;这将有助于确定远程计算机上是否存在 ssh 问题。

I would make sure your staging server has ssh access to github. Run the same command "ssh -vT [email protected]" via a terminal on your staging server; this will help determine if it is ssh problem on the remote machine.

婴鹅 2024-12-20 06:32:56

在为 Mac OS X 安装 GitHub 后,我遇到了同样的问题。该应用程序在 ~/.ssh/github_rsa 中创建了一个新的 ssh 私钥,并将其添加到 ssh 身份验证代理中。

检查 ssh 身份验证代理已缓存哪个密钥:

$ ssh-add -l
2048 63:0c:a6:51:63:c1:35:76:5d:02:77:97:39:48:0e:4a /Users/jiangxin/.ssh/github_rsa (RSA)

每当您连接到 github.com 或其他 ssh 服务时,都会首先使用此密钥。

使用以下命令清除 ssh-agent 中缓存的密钥:

$ ssh-add -D

现在 ssh 客户端应该可以正常工作,使用 ~/.ssh/config 或 ~/.ssh/id_rsa 中定义的密钥。

I met with the same problem after installing GitHub for Mac OS X. The application created a new ssh private key in ~/.ssh/github_rsa and added it to the ssh authentication agent.

Check which key the ssh auth agent has cached:

$ ssh-add -l
2048 63:0c:a6:51:63:c1:35:76:5d:02:77:97:39:48:0e:4a /Users/jiangxin/.ssh/github_rsa (RSA)

Whenever you connect to github.com or another ssh services, this key is used first.

Clear the cached keys from ssh-agent using this command:

$ ssh-add -D

Now the ssh client should work normally, using the key defined in ~/.ssh/config or ~/.ssh/id_rsa.

死开点丶别碍眼 2024-12-20 06:32:56

如果您使用的是MAC。也许您的 ssh 密钥未添加到身份验证代理。 以下命令将执行此操作

ssh-add path_to_private_key

例如,

ssh-add ~/.ssh/id_rsa

If you are using MAC. Maybe your ssh key is not added to authentication agent. Following command will do that

ssh-add path_to_private_key

for example

ssh-add ~/.ssh/id_rsa
静谧 2024-12-20 06:32:56

该错误是因为 ssh-add 不知道如何与身份验证代理通信。
通过设置 SSH_AUTH_SOCK 环境变量可以解决该问题。

如果你运行 ssh-agent 你应该得到一些像这样的输出:

SSH_AUTH_SOCK=/tmp/ssh-agVZL13989/agent.13989; export SSH_AUTH_SOCK;
SSH_AGENT_PID=13990; export SSH_AGENT_PID;
echo Agent pid 13990;SSH_AUTH_SOCK=/tmp/ssh-agVZL13989/agent.13989; export SSH_AUTH_SOCK;
SSH_AGENT_PID=13990; export SSH_AGENT_PID;
echo Agent pid 13990;

执行这个:

eval $(ssh-agent)

然后:

ssh-add -D

The error is because, ssh-add does not know how to talk with the authentication agent.
The problem can be solved by setting SSH_AUTH_SOCK environment variable.

If you run ssh-agent you should get some output like this:

SSH_AUTH_SOCK=/tmp/ssh-agVZL13989/agent.13989; export SSH_AUTH_SOCK;
SSH_AGENT_PID=13990; export SSH_AGENT_PID;
echo Agent pid 13990;SSH_AUTH_SOCK=/tmp/ssh-agVZL13989/agent.13989; export SSH_AUTH_SOCK;
SSH_AGENT_PID=13990; export SSH_AGENT_PID;
echo Agent pid 13990;

Execute this :

eval $(ssh-agent)

And then :

ssh-add -D
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文