簡體   English   中英

Bitbucket ssh 克隆權限被拒絕(公鑰)

[英]Bitbucket ssh clone Permission denied (publickey)

我在使用 bitbucket 時遇到了一些問題,我正在嘗試使用 ssh 連接配置 ubuntu 服務器。 連接測試工作完美,但 git 命令返回權限被拒絕。

知道如何解決嗎?

sudo git 克隆 git@bitbucket.org:workspace/repo.git

Cloning into 'repo'...
git@bitbucket.org: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

ssh -T git@bitbucket.org

logged in as user

You can use git to connect to Bitbucket. Shell access is disabled

ssh -v git@bitbucket.org

OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n  7 Dec 2017
debug1: Reading configuration data /home/ubuntu/.ssh/config
debug1: /home/ubuntu/.ssh/config line 1: Applying options for bitbucket.org
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to bitbucket.org [18.205.93.1] port 22.
debug1: Connection established.
debug1: identity file /home/ubuntu/.ssh/bitbucket type 0
debug1: key_load_public: No such file or directory
debug1: identity file /home/ubuntu/.ssh/bitbucket-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.6p1 Ubuntu-4ubuntu0.3
debug1: Remote protocol version 2.0, remote software version conker_fd15f4a5a7-dirty conker-3000
debug1: no match: conker_fd15f4a5a7-dirty conker-3000
debug1: Authenticating to bitbucket.org:22 as 'git'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256@libssh.org
debug1: kex: host key algorithm: ssh-rsa
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ssh-rsa SHA256:zzXQOXSRBEaDSDKLSKAJSaxvSc0ojez9YXaGp1A
debug1: Host 'bitbucket.org' is known and matches the RSA host key.
debug1: Found key in /home/ubuntu/.ssh/known_hosts:1
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering public key: RSA SHA256:lZBehjvQfr95nWiLDASDKJSSAmQ1BHwebaPeZfzrxw /home/ubuntu/.ssh/bitbucket
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug1: Authentication succeeded (publickey).
Authenticated to bitbucket.org ([18.205.93.1]:22).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: pledge: network
debug1: Sending environment.
debug1: Sending env LANG = C.UTF-8
debug1: Sending env LC_CTYPE = C.UTF-8
PTY allocation request failed on channel 0
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
logged in as user

You can use git to connect to Bitbucket. Shell access is disabled
debug1: channel 0: free: client-session, nchannels 1
Connection to bitbucket.org closed.
Transferred: sent 3020, received 1804 bytes, in 0.0 seconds
Bytes per second: sent 515896.1, received 308171.1
debug1: Exit status 0
  • Ubuntu 18.04.5 LTS

首先不要使用sudo :如果您的ssh -Tv工作,它作為您當前的用戶工作,與/home/current-user/.ssh/<yourKey>

但是使用 sudo,您將切換到超級用戶,使用/root/.ssh/密鑰,這些密鑰可能不存在或注冊到 BitBucket。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM