用 Bitbucket 托管代码,服务器 git clone [email protected]:xxx/xxx.git
提示
Permission denied (publickey).
fatal: Could not read from remote repository.
ssh -v [email protected]
结果如下
OpenSSH_6.6.1, OpenSSL 1.0.1e-fips 11 Feb 2013
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 56: Applying options for *
debug1: Connecting to bitbucket.org [104.192.143.1] port 22.
debug1: Connection established.
debug1: identity file /home/root/.ssh/id_rsa type 1
debug1: identity file /home/root/.ssh/id_rsa-cert type -1
debug1: identity file /home/root/.ssh/id_dsa type -1
debug1: identity file /home/root/.ssh/id_dsa-cert type -1
debug1: identity file /home/root/.ssh/id_ecdsa type -1
debug1: identity file /home/root/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/root/.ssh/id_ed25519 type -1
debug1: identity file /home/root/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1
debug1: Remote protocol version 2.0, remote software version conker_1.0.288-e9ef8ea app-152
debug1: no match: conker_1.0.288-e9ef8ea app-152
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: kex: [email protected] need=20 dh_need=20
debug1: kex: [email protected] need=20 dh_need=20
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: RSA 97:8c:1b:f2:6f:14:6b:5c:3b:ec:aa:46:46:74:7c:40
debug1: Host 'bitbucket.org' is known and matches the RSA host key.
debug1: Found key in /home/root/.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 RSA public key: /home/root/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug1: Authentication succeeded (publickey).
Authenticated to bitbucket.org ([104.192.143.1]:22).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
PTY allocation request failed on channel 0
authenticated via a deploy key.
You can use git or hg to connect to Bitbucket. Shell access is disabled.
This deploy key has read access to the following repositories:
okchum/enbo: root@west -- root@west
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: channel 0: free: client-session, nchannels 1
Connection to bitbucket.org closed.
Transferred: sent 3600, received 1872 bytes, in 3.6 seconds
Bytes per second: sent 1003.6, received 521.9
debug1: Exit status 0
但是奇怪的是 MacBook 上用同样的 private key 克隆,没问题。看起来是服务器问题。 已经多次生成 key pairs ,将 public key 放到 bitbucket 了,没解决问题。 也试过 chmod 600 ~/.ssh/id_rsa
ssh-add -l 也有这个 private key
大家帮忙看下还有什么思路解决?
谢谢大伙
1
SoloCompany 2017-04-17 23:16:22 +08:00 1
先升级一下你本地的 ssh 吧
|
2
sagaxu 2017-04-17 23:32:45 +08:00 1
用 sudo 了?
|
3
msg7086 2017-04-18 01:24:59 +08:00 1
/home/root/.ssh/id_rsa
会不会和这个奇怪的路径有关? |
4
Valyrian 2017-04-18 01:38:59 +08:00 1
可以试试 ssh -A
|
5
DravenJohnson 2017-04-18 04:42:08 +08:00 1
`chmod 400 ~/.ssh/id_rsa`
|
6
DravenJohnson 2017-04-18 04:43:14 +08:00 1
@DravenJohnson
先确定你的 ~ 和 `/home/root/` 是一样的,如果服务器登陆用户不是 root 而且又用了 sudo 的话, key 的位置可能会不一样 |
7
BOYPT 2017-04-18 10:16:12 +08:00 1
似乎是在 git 里面跑了不一样的 ssh 命令,先看看~/.gitconfig 等全局配置看看有什么奇怪的东西不
|