13 มิถุนายน 2563

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

If you found the error like this when cloning your repository from bitbucket

$ git clone git@bitbucket.org:repo/app.git

Cloning into 'app'...

The authenticity of host 'bitbucket.org (1.2.3.4)' can't be established.

RSA key fingerprint is SHA256:xxx.

Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added 'bitbucket.org,1.2.3.4' (RSA) to the list of known hosts.

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.


You can solve it by these steps

1. add or edit ~/.ssh/config file (create a new one if you don't have this file)

2. copy the path of your Bitbucket private key (id_rsa), e.g, /Users/user/.ssh/id_rsa

3. add this text to your ~/.ssh/config

Host bitbucket.org

  IdentityFile /Users/user/.ssh/id_rsa


4. re-clone your Bitbucket repository

ไม่มีความคิดเห็น:

แสดงความคิดเห็น

บทความยอดนิยม (ล่าสุด)

บทความยอดนิยม (1 ปีย้อนหลัง)