Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

bitbucket.org: Permission denied (publickey)

Tags:

git

bitbucket

I want to perform git clone from bitbucket.org

git clone [email protected]:mascai/regru_junjob.git

Received error:

Cloning into 'regru_junjob'... Warning: Permanently added the RSA host key for IP address '2406:da00:ff00::34cc:ea4a' to the list of known hosts.

Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.

I add pub and private keys to my server:

~/.ssh# ls
authorized_keys  id_rsa.pub  known_hosts  reg_jj  reg_jj.pub

Added pub key to the bitbucket.org https://bitbucket.org/mascai/regru_junjob/admin/access-keys/

What is the reason of the error?

May be usefull

~# ls -la ~/.ssh/
total 28
drwx------ 2 root root 4096 ноя 13 15:26 .
drwx------ 4 root root 4096 ноя 13 15:26 ..
-rw------- 1 root root  782 ноя 13 14:26 authorized_keys
-rw-r--r-- 1 root root  381 ноя 13 15:25 id_rsa.pub
-rw-r--r-- 1 root root 3978 ноя 13 15:35 known_hosts
-rw-r--r-- 1 root root 1679 ноя 13 15:26 reg_jj
-rw-r--r-- 1 root root  391 ноя 13 14:54 reg_jj.pub
like image 866
alcoder Avatar asked Sep 17 '25 08:09

alcoder


1 Answers

Using the command ssh -Tv [email protected] suggested by @phd, I was able to figure out the issue. It was indeed, a permissions issue

Permissions 0664 for '/home/ubuntu/.ssh/id_rsa' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
like image 161
Alex Donnelly Avatar answered Sep 19 '25 22:09

Alex Donnelly