git clone出来ない時にIPアドレスを変更した対処

エラー内容

$ git clone git@bitbucket.org:リモートリポジトリ
Cloning into リモートリポジトリ...
Forbidden
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

ローカル環境に登録されたgitの登録内容とBitbucketに登録されたユーザ名とアドレスが、異なっていたので、とりあえず合わせてみることに。

$ git config --global user.name 
旧ユーザ
$ git config --global user.name “新ユーザ”
$ git config --global user.name
新ユーザ
$ git config --global user.email
旧アドレス
$ git config --global user.email 新アドレス
$ git config --global user.email
新アドレス

ここで再度git clone

$ git clone git@bitbucket.org:リモートリポジトリ
Cloning into ‘リモートリポジトリ'...
Warning: Permanently added the RSA host key for IP address ‘IPアドレスが書かれてる’ to the list of known hosts.
Forbidden
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

BitbucketのIPアドレスが変わった時に怒られるエラーぽい

参考になった記事たち

SSH接続でgit pushしたときに警告が出るやつへの対処法 - Qiita https://0371.blog/programming/bitbucket-git-push-ssh

解決

$ ssh-keygen -R '書かれていたIPアドレス'