ssh heroku 错误“通道 0 上的 PTY 分配请求失败”

Posted

技术标签:

【中文标题】ssh heroku 错误“通道 0 上的 PTY 分配请求失败”【英文标题】:ssh heroku error "PTY allocation request failed on channel 0 " 【发布时间】:2017-02-19 14:48:07 【问题描述】:

我正在尝试 ssh 进入 heroku(访问命令行)... 我按照https://devcenter.heroku.com/articles/keys 中的说明进行操作,但我不断收到此错误:

PTY allocation request failed on channel 0
shell request failed on channel 0

整个日志:

debug1: Reading configuration data /home/gilad/.ssh/config
debug1: /home/gilad/.ssh/config line 1: Applying options for heroku.com
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to heroku.com [50.19.85.132] port 22.
debug1: Connection established.
debug1: identity file /home/gilad/.ssh/ssh-dss type -1
debug1: identity file /home/gilad/.ssh/ssh-dss-cert type -1
debug1: identity file /home/gilad/.ssh/id_rsa type 1
debug1: identity file /home/gilad/.ssh/id_rsa-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.8
debug1: Remote protocol version 2.0, remote software version endosome
debug1: no match: endosome
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-sha1 none
debug1: kex: client->server aes128-ctr hmac-sha1 none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: RSA 8b:48:5e:67:0e:c9:16:47:32:f2:87:0c:1f:c8:60:ad
debug1: Host 'heroku.com' is known and matches the RSA host key.
debug1: Found key in /home/gilad/.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: 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: /home/gilad/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug1: Authentication succeeded (publickey).
Authenticated to heroku.com ([50.19.85.132]:22).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: Sending environment.
debug1: Sending env LC_PAPER = he_IL.UTF-8
debug1: Sending env LC_ADDRESS = he_IL.UTF-8
debug1: Sending env LC_MONETARY = he_IL.UTF-8
debug1: Sending env LC_NUMERIC = he_IL.UTF-8
debug1: Sending env LC_TELEPHONE = he_IL.UTF-8
debug1: Sending env LC_IDENTIFICATION = he_IL.UTF-8
debug1: Sending env LANG = en_US.UTF-8
debug1: Sending env LC_MEASUREMENT = he_IL.UTF-8
debug1: Sending env LC_TIME = he_IL.UTF-8
debug1: Sending env LC_NAME = he_IL.UTF-8
PTY allocation request failed on channel 0
shell request failed on channel 0

ssh_config:

Host heroku.com
  HostName heroku.com
  IdentityFile ~/.ssh/id_rsa
  IdentitiesOnly yes

我真的明白这意味着什么——帮助?

【问题讨论】:

尝试改变事物,看看会发生什么。尝试再次浏览指南,看看是否有帮助。然后,如果您仍然无法获得它,请告诉我们您尝试了什么,什么没有奏效。如果你表现出努力,人们更有可能提供帮助。另外,如果可以的话,通常避免“整个日志:”,同时仍然提出一个完整的问题。浏览这篇文章,它将帮助您改进您的问题:***.com/help/mcve PTY 和 shell 请求消息意味着服务器不愿意为您启动交互式会话。这对 Heroku 来说可能是正常的。您链接到的 Heroku 页面正在讨论使用 ssh 进行 git 访问,这不需要 PTY 或 shell。是什么让您认为 shell 访问应该有效? 【参考方案1】:

您可以通过首先安装heroku toolbelt ssh 进入heroku dyno,然后在登录工具带后,您可以运行heroku run bash --app your_app_name

请参阅here 了解有关它的 heroku 文档。注意他们的警告,虽然说使用 ssh 没有什么好处

【讨论】:

以上是关于ssh heroku 错误“通道 0 上的 PTY 分配请求失败”的主要内容,如果未能解决你的问题,请参考以下文章

Heroku 错误:“权限被拒绝(公钥)”

Heroku 问题错误:未能推送一些参考

厌倦了我的 Rails 应用程序的 Heroku SSH 混乱

来自 Heroku 的 SSH 隧道

Heroku push master ssh 问题

多个帐户heroku键混淆