对于“通道 0 上的 PTY 分配请求失败”该怎么办?

发布于 2024-09-25 15:37:07 字数 1430 浏览 0 评论 0 原文

我不知道如何为 GitHub 创建 ssh 密钥。我已经让它工作了一段时间了,但我不知道发生了什么变化。我已经从我的 GitHub 帐户中删除了以前的 SSH 密钥。多次按照说明生成 SSH 密钥后 (http://help.github.com/mac -key-setup)并测试“ssh [电子邮件受保护]“我得到以下信息;

PTY 分配请求失败于 通道 0 错误:嗨...成功 已验证...GitHub 没有 提供 shell 访问...连接到 github.com 关闭。

我查看了 故障排除指南 并注意到我的 ssh 目录没有配置文件。创建后,我不确定在 IdentityFile 行上输入什么或如何输入本地路径。我什至不确定这对于我的情况是否有必要?

如果你的github认证 信息与您的不同 机器帐户信息,您将 需要修改你的ssh配置 文件。

创建或打开文件 ~/.ssh/config 添加以下行:

Host github.com
    User git
    Hostname github.com
    PreferredAuthentications publickey
    IdentityFile [local path to private key half of github public key you provided]

您可能还需要更新 .ssh 文件夹的权限和 它的内容。 SSH 应用程序将 忽略太秘密的文件 宽容。

$ chmod 700 ~/.ssh
$ chmod 600 ~/.ssh/*

我还运行了 ssh -v [email protected] 其结果可以是在这里看到 http://gist.github.com/607283 与我所知没有什么不同。

知道我做错了什么吗?

I can't see to wrap my head creating an ssh key for GitHub. I had it working quite awhile back but I can't figure out what has changed. I've since removed the previous SSH keys from my GitHub account. After following the instructions several times for generating an SSH key (http://help.github.com/mac-key-setup) and testing "ssh [email protected]" I get the following;

PTY allocation request failed on
channel 0 ERROR: Hi...successfully
authenticated...GitHub does not
provide shell access...Connection to
github.com closed.

I reviewed the troubleshooting guide and noticed that my ssh directory didn't have a config file. After creating it I'm unsure of what or how to enter the local path on the IdentityFile line. I'm not even sure whether this is necessary in my case?

If your github authentication
information is different from your
machine account information, you’ll
need to modify your ssh configuration
file.

Create or open the file at
~/.ssh/config Add the following lines:

Host github.com
    User git
    Hostname github.com
    PreferredAuthentications publickey
    IdentityFile [local path to private key half of github public key you provided]

You may also need to update the
permissions on your .ssh folder and
its contents. The SSH application will
ignore secret files that are too
permissive.

$ chmod 700 ~/.ssh
$ chmod 600 ~/.ssh/*

I also ran ssh -v [email protected] the results of which can be seen here http://gist.github.com/607283 nothing different from what I can tell.

Any idea what I'm doing wrong?

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

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

发布评论

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

评论(1

女皇必胜 2024-10-02 15:37:07

正如该问题的评论中所述,“PTY 分配请求失败”对于 GitHub 身份验证来说是一个转移注意力的问题(这是当他们提供的唯一 SSH 服务是非交互式 Git 时尝试交互式登录 GitHub 的结果) over-SSH;身份验证有效,只是不提供交互式“shell”服务)。


提出这个问题的人在评论中写道:

我想相关的问题是,当我尝试创建一个新的存储库和“git push origin master”时,我返回以下“错误:权限 [电子邮件受保护]/myapp 拒绝发送给我的用户名。致命:远程端意外挂断”

这似乎更有可能是实际问题。这似乎表明名为 origin 的远程未配置为正确指向 GitHub 存储库。

检查 git Remote show -n origin 的输出。可能“获取 URL”和“推送 URL”是相同的。它们都应该如下所示:

[email protected]:git-user-name/repository-name

在网络上登录 GitHub 时,您可以使用帐户的用户名或其关联的电子邮件地址。当推送到存储库(或从私人存储库获取)时,您必须使用您的实际用户名(电子邮件地址不起作用)。您似乎在其中使用了您的电子邮件地址,而不仅仅是您的 GitHub 用户名。要解决此问题,请重新配置远程 URL:

git remote set-url origin [email protected]:github-username/repository-name

登录后,您的用户名会显示在 GitHub 网页上的许多位置。最容易找到它的位置是您的头像和页面标题上的“仪表板”链接之间(您将如果您没有配置头像,请查看剪影图标)。同一位置链接到您的公开个人资料页面;此页面的 URL 也应以您的用户名结尾。

As described in the comments on the question, the “PTY allocation request failed” is a red herring with respect to GitHub authentication (it is the result of trying to interactively login to GitHub when the only SSH service they offer is non-interactive Git-over-SSH; the authentication is working, they just do not provide interactive, “shell” service).


The person who asked the question wrote this in a comment:

I guess the related problem is that when I try to create a new repository and "git push origin master" I return the following "Error: Permission to [email protected]/myapp denied to myusername. Fatal: the remote end hung up unexpectedly"

This seems more likely to be the actual problem. This seems to indicate that the remote named origin not configured to correctly point to a GitHub repository.

Check the output of git remote show -n origin. Probably the “Fetch URL” and the “Push URL” are the same. They should both look like this:

[email protected]:git-user-name/repository-name

When logging into GitHub on the web you can use either your account’s username or its associated email address. When pushing to repositories (or fetching from private repositories) you have to use your actual username (an email address will not work). It looks you are using your email address in there instead of just your GitHub username. To fix this, reconfigure the remote’s URL:

git remote set-url origin [email protected]:github-username/repository-name

Your username is displayed in many places on the GitHub web pages once you are logged in. The easiest place to find it is between your gravatar and the “Dashboard” link on the page header (you will see a silhouette icon if you do not have a gravatar configured). That same location links to your public profile page; this page’s URL should also end in your username.

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