【问题标题】:bitbucket.org: Permission denied (publickey)bitbucket.org:权限被拒绝(公钥)
【发布时间】:2021-08-13 02:07:40
【问题描述】:

我想表演 来自 bitbucket.org 的 git 克隆

git clone git@bitbucket.org:mascai/regru_junjob.git

收到错误:

正在克隆到“regru_junjob”... 警告:将 IP 地址“2406:da00:ff00::34cc:ea4a”的 RSA 主机密钥永久添加到已知主机列表中。

权限被拒绝(公钥)。 致命:无法从远程存储库中读取。 请确保您拥有正确的访问权限 并且存储库存在。

我将 pub 和私钥添加到我的服务器:

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

向 bitbucket.org 添加了 pub 密钥 https://bitbucket.org/mascai/regru_junjob/admin/access-keys/

错误的原因是什么?

可能有用

~# 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

【问题讨论】:

  • 您是否为~/.ssh/ 设置了错误的文件权限?让我们看看ls -la ~/.ssh/ 的结果,如果你愿意分享的话。
  • 您是否使用过密钥“id_rsa.pub”?该密钥用于默认身份验证。
  • 添加了 id_rsa.pub 但再次收到错误。 .ssh 权限可以吗?
  • 如果您有多个 ssh 密钥,则需要以这种方式设置它们 - blog.developer.atlassian.com/…。仔细阅读,进行设置,不要忘记根据配置文件中的别名更改 git clone 地址。

标签: git bitbucket


【解决方案1】:

使用@phd 建议的命令ssh -Tv git@bitbucket.org,我能够找出问题所在。确实是权限问题

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.

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-03-11
    • 2019-11-24
    • 2014-11-08
    • 2012-01-18
    • 2012-04-25
    • 2014-03-18
    相关资源
    最近更新 更多