Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Git 为什么授予权限的cap部署被拒绝(公钥)?_Git_Ssh_Capistrano_Ssh Keys_Public Key - Fatal编程技术网

Git 为什么授予权限的cap部署被拒绝(公钥)?

Git 为什么授予权限的cap部署被拒绝(公钥)?,git,ssh,capistrano,ssh-keys,public-key,Git,Ssh,Capistrano,Ssh Keys,Public Key,好吧,我有点困惑。。。我可以很好地提交到我的github存储库,但是当我尝试从本地文件夹向临时服务器执行cap部署时,我得到了权限拒绝(publickey)。 如果我运行sshgit@github.com我实际收到一个错误通道0上的PTY分配请求失败 所以这里有点不对劲 如果我运行ssh-vTgit@github.com我得到: OpenSSH_5.6p1, OpenSSL 0.9.8r 8 Feb 2011 debug1: Reading configuration data /Users/m

好吧,我有点困惑。。。我可以很好地提交到我的github存储库,但是当我尝试从本地文件夹向临时服务器执行
cap部署时,我得到了
权限拒绝(publickey)。

如果我运行
sshgit@github.com
我实际收到一个错误
通道0上的PTY分配请求失败

所以这里有点不对劲

如果我运行
ssh-vTgit@github.com
我得到:

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 no-more-sessions@openssh.com
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 eow@openssh.com 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
OpenSSH_5.6p1,OpenSSL 0.9.8r 2011年2月8日
debug1:正在读取配置数据/Users/myuser/.ssh/config
debug1:读取配置数据/etc/ssh\u config
debug1:将选项应用于*
debug1:连接到github.com[207.97.227.239]端口22。
debug1:已建立连接。
debug1:identity file/Users/myuser/.ssh/id\u rsa类型1
debug1:identity file/Users/myuser/.ssh/id\u rsa-cert类型-1
debug1:identity file/Users/myuser/.ssh/id_dsa type-1
debug1:identity file/Users/myuser/.ssh/id_dsa-cert type-1
debug1:远程协议版本2.0,远程软件版本OpenSSH_5.1p1 Debian-5github2
debug1:match:OpenSSH_5.1p1 Debian-5github2 pat OpenSSH*
debug1:启用协议2.0的兼容模式
debug1:本地版本字符串SSH-2.0-OpenSSH_5.6
debug1:SSH2\u MSG\u KEXINIT已发送
debug1:SSH2\u MSG\u KEXINIT已收到
debug1:kex:server->client aes128 ctr hmac-md5无
debug1:kex:客户端->服务器aes128 ctr hmac-md5无

debug1:SSH2\u MSG\u KEX\u DH\u GEX\u请求(1024我将确保您的登台服务器具有对github的ssh访问权限。运行相同的命令“ssh-vTgit@github.com"通过登台服务器上的终端;这将有助于确定远程计算机上是否存在ssh问题。

在安装GitHub for Mac OS X后,我遇到了相同的问题。应用程序在~/.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代理清除缓存的密钥:

$ ssh-add -D

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

我必须执行以下操作:

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

错误是因为ssh add不知道如何与身份验证代理通信。 这个问题可以通过设置SSH\u AUTH\u SOCK环境变量来解决

如果运行ssh代理,则应获得如下输出:

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

我有时会遇到这个错误,我只是键入
$ssh add-k
来添加我的身份,然后它就工作了。不确定为什么会这样做,或者为什么错误消息不建议这样做,但如果您使用MAC,它总是会起到解救作用!

。可能您的ssh密钥没有添加到身份验证代理。下面的命令可以做到这一点

ssh-add path_to_private_key
比如说

ssh-add ~/.ssh/id_rsa

这很有效,谢谢:),我忽略了那个部分。但我还是不知道为什么“嘘”git@github.com正在返回“通道0上的PTY分配请求失败”?是否可以通过ssh连接到其他服务器而不出现此问题?我将检查此线程:。谢谢,你的链接最终让我找到了这个答案。引用答案“PTY分配请求失败”是GitHub身份验证的一个障碍(这是当他们提供的唯一SSH服务是非交互式Git over SSH时,尝试以交互方式登录GitHub的结果;身份验证正在工作,他们只是不提供交互的“shell”服务)请注意,如果您有
set:ssh\u选项,forward\u agent:true
(这是处理capistrano中的密钥的一个好方法),那么这可能会成为一个麻烦。如果您使用的是代理转发,那么即使其他一切正常,您也不一定能够从远程服务器ssh到github,这意味着最初的问题可能与本地ssh配置有关。亲爱的Sankalp,您的回答非常简短,应该提供一些附加信息,以防止其被删除(已被其他用户标记为删除)谢谢@furins.。我会写一些信息。为什么
ssh add-D
?这只是要删除你的身份。不要认为这会有助于解决问题。然后使用
ssh add
将其添加回来这就是问题的确切答案。不需要在你的后台计算机上添加ssh密钥。只需运行上面的命令并完成即可…谢谢@olorebt这背后的原因是什么?此命令做了什么来解决此问题?上面的命令将RSA/DSA标识添加到身份验证代理,该代理会在部署时检查权限。出于某种原因,如果在运行deploy命令之前未添加标识,则会出现权限拒绝错误。对于我来说,每当重新启动计算机时r、 我需要键入上述命令才能使其正常工作。我发现每次重新启动后都不会自动添加ssh公钥。因此,在上述命令之后,我使用
ssh add-K
将输出添加到Keychain。之后,我的问题得到了永久解决。我在Debian中遇到了一个巨大的问题,使用了一个具有不同nam的密钥而不是
id\u rsa
。我刚刚做了
ssh添加$HOME/.ssh/[key\u name]
。这对我很有效。我在将文件系统传输到新计算机后遇到了错误。