Bitbucketからgit clone(SSH接続)

数年ぶりにbitbucketにリポジトリを作る用事ができた。 公開鍵はユーザーページのSettings => SSH keysから登録する。 いつもの公開鍵を登録後、早速リポジトリを作りクローンしようとしてみたら

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.

あ。。。
Set up an SSH key - Atlassian Documentationを参考に

ssh -T git@bitbucket.org

すると、

git@bitbucket.org: Permission denied (publickey).

試しに秘密鍵を指定して

ssh -T git@bitbucket.org -i path/to/secret_key

すると、

logged in as w.

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

となり、接続成功。

cd ~/.ssh
cp secret_key id_rsa
ssh -T git@bitbucket.org

とすると接続できたので、秘密鍵の名前はid_rsaでなければならないらしい。
git clone 時に秘密鍵を指定するを参考に

GIT_SSH_COMMAND="ssh -i ~/.ssh/id_rsa_example -F /dev/null" git clone example
git config core.sshCommand "ssh -i ~/.ssh/id_rsa_example -F /dev/null"

で運用することにした。 windowsの場合

git config core.sshCommand "ssh -i C:\\\Users\\\user\\\.ssh\\\id_rsa_example -F /dev/null"

というような書き方になる。