2011-01-09 126 views
10

我跟着本指南中給出的每一步: http://help.github.com/linux-key-setup/Ubuntu的Github上的SSH密鑰問題

當我到了我能ssh到[email protected]結束,得到了響應:

PTY通道0上的分配請求失敗 嗨AlexBaranosky!您已成功通過身份驗證,但GitHub不提供shell訪問權限。 連接到github.com關閉

但是,當我去克隆我的回購失敗說:

權限被拒絕(公鑰)。 致命:遠程端掛了意外

我使用Github上很多

,但是這是我第一次使用它從Ubuntu的電腦,有我丟失的東西嗎?

任何幫助,非常感謝。

亞歷

編輯:

內容的

ssh -v [email protected]

[email protected]:~/proj$ ssh -v [email protected] 
OpenSSH_5.3p1 Debian-3ubuntu4, OpenSSL 0.9.8k 25 Mar 2009 
debug1: Reading configuration data /etc/ssh/ssh_config 
debug1: Applying options for * 
debug1: Connecting to github.com [207.97.227.239] port 22. 
debug1: Connection established. 
debug1: identity file /home/alex/.ssh/identity type -1 
debug1: identity file /home/alex/.ssh/id_rsa type 1 
debug1: Checking blacklist file /usr/share/ssh/blacklist.RSA-2048 
debug1: Checking blacklist file /etc/ssh/blacklist.RSA-2048 
debug1: identity file /home/alex/.ssh/id_dsa 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.3p1 Debian-3ubuntu4 
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 /home/alex/.ssh/known_hosts:1 
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 public key: /home/alex/.ssh/id_rsa 
debug1: Remote: Forced command: gerve AlexBaranosky 
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 277 
debug1: Remote: Forced command: gerve AlexBaranosky 
debug1: Remote: Port forwarding disabled. 
debug1: Remote: X11 forwarding disabled. 
debug1: Remote: Agent forwarding disabled. 
debug1: Remote: Pty allocation disabled. 
debug1: Authentication succeeded (publickey). 
debug1: channel 0: new [client-session] 
debug1: Requesting [email protected] 
debug1: Entering interactive session. 
debug1: Sending environment. 
debug1: Sending env LANG = en_US.utf8 
PTY allocation request failed on channel 0 
Hi AlexBaranosky! You've successfully authenticated, but GitHub does not provide shell access. 
       debug1: client_input_channel_req: channel 0 rtype exit-status reply 0 
debug1: client_input_channel_req: channel 0 rtype [email protected] reply 0 
debug1: channel 0: free: client-session, nchannels 1 
Connection to github.com closed. 
Transferred: sent 2592, received 2904 bytes, in 0.1 seconds 
Bytes per second: sent 44942.9, received 50352.7 
debug1: Exit status 1 

輸出運行:git clone [email protected]:AlexBaranosky/Sportello.git

fatal: could not create work tree dir 'Sportello'.: Permission denied 
+0

咦?爲什麼是-1?如果它屬於別的地方,請這麼說。 – 2011-01-09 06:04:00

回答

12

你有沒有運行所有的命令中Github指南作爲根?鑑於您已經注意到的解決方案,這是目前我能想到的唯一場景。

在任何情況下以root身份工作都是非常危險的,應儘可能避免。

我強烈建議將這些說明作爲您自己的用戶重新運行。我第二個雷的建議是用-v再試一次,我們可以從這一點幫助你。根本上使用root,特別是對於這個開發+推送過程來說,是非常危險的。只需要刪除一棵樹(rm -rf tree*),並在樹和*,bam之間無意中添加了一個空格,即丟失了大量內容。而且你也可能做得更糟。

2

SSH也許嘗試多個鍵,直到它找到一個工作。在詳細模式(混亂,但強勁)

ssh -v [email protected] 

你會看到它的SSH密鑰使用進行身份驗證。

然後,您可以rejig按鍵或添加正確的文件名的〜/ .ssh /配置主機github.com

乾杯

+0

你認爲這有什麼關係嗎?:http://www.anujgakhar.com/2010/12/28/permission-denied-publickey-with-git-on-ubuntu/所有這些sudo的東西都有點首先令人困惑。 – 2011-01-09 06:57:56

+0

也許第一個爲root嘗試的密鑰是正確的,而你的其他用戶有不同的順序?兩個用戶的ssh -v可能有助於回答這個問題。 – 2011-01-09 10:14:09