bitbucketからSSHでクローン出来ない

hiroyuki_sekiguchi April 29, 2020

bitbucketのリポジトリをクローンしようとするとエラーが出てクローンできません

git clone git@bitbucket.org:xxxx/yyyy.git

エラー

Forbidden
fatal: Could not read from remote repository.

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

そこでbitbucketのPersonal Settings⇒SSH鍵から公開鍵を追加しようとすると

そのSSHキーは既に追加されています

と言われて追加できません。どうすればクローン出来るようになるでしょうか?

お返事お待ちしております。

※HTTPを使用した場合は正常にクローンできます。HTTPでは頻繁にパスワードの入力を求められるのでSSHでクローンしたいのです。

2 answers

0 votes
hiroyuki_sekiguchi May 7, 2020

ご回答ありがとうございます。

以下でアカウントを確認したところhiroyuki-sekiguchiでした。またクローンしようとしているリポジトリも同じアカウントにあります。問題ないように見受けられます。

ssh -T git@bitbucket.org

 

以下がクローン時のログになります。やはりクローンはできません。リポジトリ名は伏せてあります。

11:08:48.361069 exec-cmd.c:236 trace: resolved executable dir: C:/Program Files/Git/mingw64/bin
11:08:48.362041 git.c:419 trace: built-in: git clone git@bitbucket.org:i-meisters/manga100website.git
Cloning into 'xxxxxxxxxxxx'...
11:08:48.376031 run-command.c:643 trace: run_command: unset GIT_DIR; 'ssh -v' git@bitbucket.org 'git-upload-pack '\''yyyyyyyyyyy/xxxxxxxxxxxxxxxxxx.git'\'''
OpenSSH_7.9p1, OpenSSL 1.1.1a 20 Nov 2018
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to bitbucket.org [2406:da00:ff00::22c0:3470] port 22.
debug1: Connection established.
debug1: identity file /c/Users/Hiroyuki Sekiguchi/.ssh/id_rsa type 0
debug1: identity file /c/Users/Hiroyuki Sekiguchi/.ssh/id_rsa-cert type -1
debug1: identity file /c/Users/Hiroyuki Sekiguchi/.ssh/id_dsa type -1
debug1: identity file /c/Users/Hiroyuki Sekiguchi/.ssh/id_dsa-cert type -1
debug1: identity file /c/Users/Hiroyuki Sekiguchi/.ssh/id_ecdsa type -1
debug1: identity file /c/Users/Hiroyuki Sekiguchi/.ssh/id_ecdsa-cert type -1
debug1: identity file /c/Users/Hiroyuki Sekiguchi/.ssh/id_ed25519 type -1
debug1: identity file /c/Users/Hiroyuki Sekiguchi/.ssh/id_ed25519-cert type -1
debug1: identity file /c/Users/Hiroyuki Sekiguchi/.ssh/id_xmss type -1
debug1: identity file /c/Users/Hiroyuki Sekiguchi/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.9
debug1: Remote protocol version 2.0, remote software version conker_f765b92162-dirty app-162
debug1: no match: conker_f765b92162-dirty app-162
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:zzXQOXSRBEiUtuE8AikJYKwbHaxvSc0ojez9YXaGp1A
debug1: Host 'bitbucket.org' is known and matches the RSA host key.
debug1: Found key in /c/Users/Hiroyuki Sekiguchi/.ssh/known_hosts:3
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: Will attempt key: /c/Users/Hiroyuki Sekiguchi/.ssh/id_rsa RSA SHA256:fIvDUMZPt0OAGp0KdqFaOyzekpoYfqpP5ctPlOHmA7U
debug1: Will attempt key: /c/Users/Hiroyuki Sekiguchi/.ssh/id_dsa
debug1: Will attempt key: /c/Users/Hiroyuki Sekiguchi/.ssh/id_ecdsa
debug1: Will attempt key: /c/Users/Hiroyuki Sekiguchi/.ssh/id_ed25519
debug1: Will attempt key: /c/Users/Hiroyuki Sekiguchi/.ssh/id_xmss
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering public key: /c/Users/Hiroyuki Sekiguchi/.ssh/id_rsa RSA SHA256:fIvDUMZPt0OAGp0KdqFaOyzekpoYfqpP5ctPlOHmA7U
debug1: Server accepts key: /c/Users/Hiroyuki Sekiguchi/.ssh/id_rsa RSA SHA256:fIvDUMZPt0OAGp0KdqFaOyzekpoYfqpP5ctPlOHmA7U
Enter passphrase for key '/c/Users/Hiroyuki Sekiguchi/.ssh/id_rsa':
debug1: Authentication succeeded (publickey).
Authenticated to bitbucket.org ([2406:da00:ff00::22c0:3470]:22).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: pledge: network
debug1: Sending command: git-upload-pack 'yyyyyyyyyyy/xxxxxxxxxxxxxxxxxxx.git'
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
Forbidden
debug1: channel 0: free: client-session, nchannels 1
fatal: Could not read from remTransferred: sent 3528, received 2008 bytes, in 0.4 seconds
ote reposiBytes per second: sent 8836.1, received 5029.1
torydebug1: Exit status 1

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

0 votes
K_ Yamamoto
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 7, 2020

アトラシアンの山本です。

公開鍵を追加しようとすると

そのSSHキーは既に追加されています

と言われて追加できません。

例えば他のBitbucketアカウントでSSH公開鍵を登録済みの場合は、ご利用のアカウントに対して同一の公開鍵を新たに登録し直すことはできません。どのアカウントに登録済みかは下記コマンドにてお確かめいただけます。

ssh -T git@bitbucket.org

詳しくはドキュメント Someone has already registered that SSH key をご参照下さい。

 

どうすればクローン出来るようになるでしょうか?

正しくSSH公開鍵を登録したあとも問題が起こるようであれば、下記コマンドにて詳細なログを出力することで原因の切り分けが行えます。

GIT_TRACE_PACKET=1 GIT_TRACE=1 GIT_SSH_COMMAND="ssh -v" GIT_CURL_VERBOSE=1 git clone git@bitbucket.org:xxxx/yyyy.git
hiroyuki_sekiguchi May 8, 2020

返信欄を間違えましたので再渇します。

以下でアカウントを確認したところhiroyuki-sekiguchiでした。またクローンしようとしているリポジトリも同じアカウントにあります。問題ないように見受けられます。

ssh -T git@bitbucket.org

 

以下がクローン時のログになります。やはりクローンはできません。リポジトリ名は伏せてあります。

11:08:48.361069 exec-cmd.c:236 trace: resolved executable dir: C:/Program Files/Git/mingw64/bin
11:08:48.362041 git.c:419 trace: built-in: git clone git@bitbucket.org:yyyyyyyyy/xxxxxxxxxxx.git
Cloning into 'xxxxxxxxxxxx'...
11:08:48.376031 run-command.c:643 trace: run_command: unset GIT_DIR; 'ssh -v' git@bitbucket.org 'git-upload-pack '\''yyyyyyyyyyy/xxxxxxxxxxxxxxxxxx.git'\'''
OpenSSH_7.9p1, OpenSSL 1.1.1a 20 Nov 2018
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to bitbucket.org [2406:da00:ff00::22c0:3470] port 22.
debug1: Connection established.
debug1: identity file /c/Users/Hiroyuki Sekiguchi/.ssh/id_rsa type 0
debug1: identity file /c/Users/Hiroyuki Sekiguchi/.ssh/id_rsa-cert type -1
debug1: identity file /c/Users/Hiroyuki Sekiguchi/.ssh/id_dsa type -1
debug1: identity file /c/Users/Hiroyuki Sekiguchi/.ssh/id_dsa-cert type -1
debug1: identity file /c/Users/Hiroyuki Sekiguchi/.ssh/id_ecdsa type -1
debug1: identity file /c/Users/Hiroyuki Sekiguchi/.ssh/id_ecdsa-cert type -1
debug1: identity file /c/Users/Hiroyuki Sekiguchi/.ssh/id_ed25519 type -1
debug1: identity file /c/Users/Hiroyuki Sekiguchi/.ssh/id_ed25519-cert type -1
debug1: identity file /c/Users/Hiroyuki Sekiguchi/.ssh/id_xmss type -1
debug1: identity file /c/Users/Hiroyuki Sekiguchi/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.9
debug1: Remote protocol version 2.0, remote software version conker_f765b92162-dirty app-162
debug1: no match: conker_f765b92162-dirty app-162
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:zzXQOXSRBEiUtuE8AikJYKwbHaxvSc0ojez9YXaGp1A
debug1: Host 'bitbucket.org' is known and matches the RSA host key.
debug1: Found key in /c/Users/Hiroyuki Sekiguchi/.ssh/known_hosts:3
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: Will attempt key: /c/Users/Hiroyuki Sekiguchi/.ssh/id_rsa RSA SHA256:fIvDUMZPt0OAGp0KdqFaOyzekpoYfqpP5ctPlOHmA7U
debug1: Will attempt key: /c/Users/Hiroyuki Sekiguchi/.ssh/id_dsa
debug1: Will attempt key: /c/Users/Hiroyuki Sekiguchi/.ssh/id_ecdsa
debug1: Will attempt key: /c/Users/Hiroyuki Sekiguchi/.ssh/id_ed25519
debug1: Will attempt key: /c/Users/Hiroyuki Sekiguchi/.ssh/id_xmss
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering public key: /c/Users/Hiroyuki Sekiguchi/.ssh/id_rsa RSA SHA256:fIvDUMZPt0OAGp0KdqFaOyzekpoYfqpP5ctPlOHmA7U
debug1: Server accepts key: /c/Users/Hiroyuki Sekiguchi/.ssh/id_rsa RSA SHA256:fIvDUMZPt0OAGp0KdqFaOyzekpoYfqpP5ctPlOHmA7U
Enter passphrase for key '/c/Users/Hiroyuki Sekiguchi/.ssh/id_rsa':
debug1: Authentication succeeded (publickey).
Authenticated to bitbucket.org ([2406:da00:ff00::22c0:3470]:22).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: pledge: network
debug1: Sending command: git-upload-pack 'yyyyyyyyyyy/xxxxxxxxxxxxxxxxxxx.git'
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
Forbidden
debug1: channel 0: free: client-session, nchannels 1
fatal: Could not read from remTransferred: sent 3528, received 2008 bytes, in 0.4 seconds
ote reposiBytes per second: sent 8836.1, received 5029.1
torydebug1: Exit status 1

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

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events