さわらブログ

さわら(@xhiroga)の技術ブログ

BitBucketの"Please make sure you have the correct access rights and the repository exists." と戦うのをやめてHTTPS接続にした

以下のエラーに対してトラブルシューティングを試みたのですが、どうもうまくいかないのでSSH接続を諦めました。

$ git pull
fatal: Could not read from remote repository.

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

やったこと

1. ssh接続の確認

ssh -v git@bitbucket.org
~~~
You can use git or hg to connect to Bitbucket. Shell access is disabled.
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 2988, received 1860 bytes, in 0.4 seconds
Bytes per second: sent 7712.1, received 4800.7
debug1: Exit status 0

2. remoteのurl の形式の確認

× git@bitbucket.org:{USER_NAME}/{REPOSITORY_NAME}.git
× ssh://git@bitbucket.org/{USER_NAME}/{REPOSITORY_NAME}.git

どうにもならなかったので

素直にHTTPS接続にしました。

git remote remove origin
git remote add origin https://{USER_NAME}@bitbucket.org/{USER_NAME}/{REPOSITORY_NAME}.git
git fetch

悔しい...!