【问题标题】:Permission denied (publickey) Bitbucket权限被拒绝(公钥) Bitbucket
【发布时间】:2018-03-11 01:05:29
【问题描述】:

我在 Bitbucket 中有一个存储库,但我无法克隆它,因为我正在获取

权限被拒绝(公钥)。

我已生成 SSH 密钥并将其添加到我的 Bitbucket 帐户设置中。我已经设置了我的 git 用户名和密码。

我试过运行这个命令:

ssh git@bitbucket.org

我得到了这个:

警告:为 IP 地址永久添加了 RSA 主机密钥 '104.192.143.2' 到已知主机列表。

通道 0 上的 PTY 分配请求失败

以咖啡迷的身份登录。

您可以使用 git 或 hg 连接到 Bitbucket。外壳访问是 禁用。与 bitbucket.org 的连接已关闭。

coffeejunkie 是我的 Bitbucket 用户名,所以我已经成功登录了。

但是权限仍然被拒绝。我还缺少什么?

更新:

-vvv git@bitbucket.org 给出以下内容:

OpenSSH_7.2p2 Ubuntu-4ubuntu2.2,OpenSSL 1.0.2g 2016 年 3 月 1 日调试 1: 读取配置数据 /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config 第 19 行:为 * debug2 应用选项:解决 “bitbucket.org”端口 22 debug2:ssh_connect_direct:needpriv 0 debug1: 连接到 bitbucket.org [104.192.143.2] 端口 22。 debug1: 连接已建立。 debug1:身份文件/home/coffee/.ssh/id_rsa 类型 1 debug1:key_load_public:没有这样的文件或目录 debug1: 身份文件 /home/coffee/.ssh/id_rsa-cert type -1 debug1: key_load_public:没有这样的文件或目录调试1:身份文件 /home/coffee/.ssh/id_dsa type -1 debug1: key_load_public: 没有这样的文件 或目录debug1:身份文件/home/coffee/.ssh/id_dsa-cert type -1 debug1:key_load_public:没有这样的文件或目录 debug1:身份文件/home/coffee/.ssh/id_ecdsa type -1 debug1:key_load_public:没有 此类文件或目录 debug1:身份文件 /home/coffee/.ssh/id_ecdsa-cert type -1 debug1: key_load_public: 否 此类文件或目录 debug1:身份文件 /home/coffee/.ssh/id_ed25519 type -1 debug1: key_load_public: 没有 文件或目录 debug1:身份文件 /home/coffee/.ssh/id_ed25519-cert type -1 debug1:启用 协议 2.0 debug1 的兼容模式:本地版本字符串 SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.2 debug1:远程协议 版本 2.0,远程软件版本 conker_1.0.311-c6337e4 app-134 调试1:不匹配:conker_1.0.311-c6337e4 app-134 调试2:fd 3 设置 O_NONBLOCK debug1:向 bitbucket.org:22 验证为 'git' debug3: hostkeys_foreach:读取文件“/home/coffee/.ssh/known_hosts”调试3: record_hostkey:在文件中找到密钥类型 RSA /home/coffee/.ssh/known_hosts:1 debug3: load_hostkeys: 加载 1 个密钥 来自 bitbucket.org debug3:order_hostkeyalgs:更喜欢 hostkeyalgs: ssh-rsa-cert-v01@openssh.com,rsa-sha2-512,rsa-sha2-256,ssh-rsa debug3: 发送数据包:类型 20 调试1:SSH2_MSG_KEXINIT 发送调试3:接收 数据包:类型 20 debug1:SSH2_MSG_KEXINIT 收到 debug2:本地客户端 KEXINIT 提案调试2:KEX 算法: curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman- group14-sha1,ext-info-c debug2:主机密钥算法: ssh-rsa-cert-v01@openssh.com,rsa-sha2-512,rsa-sha2-256,ssh-rsa,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert- v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ssh-ed25519-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521, ssh-ed25519 debug2:密码ctos: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-cbc,aes192-cbc,aes256-cbc,3des-加拿大广播公司 debug2:密码库存: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-cbc,aes192-cbc,aes256-cbc,3des-加拿大广播公司 debug2: MACs ctos: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@ openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1 debug2:MAC 库存: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@ openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1 debug2: 压缩 ctos: none,zlib@openssh.com,zlib debug2: 压缩 stoc:无,zlib@openssh.com,zlib debug2:语言 ctos: debug2:语言 stoc:debug2:first_kex_follows 0 debug2:保留 0 debug2:对等服务器 KEXINIT 提案 debug2:KEX 算法: curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1 debug2: 主机密钥算法: ssh-dss,ssh-rsa debug2: ciphers ctos: aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,arcfour256,arcfour128 debug2:密码库存: aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,arcfour256,arcfour128 debug2: MACs ctos: hmac-sha2-256-etm@openssh.com,hmac-sha2-256,hmac-sha1,hmac-sha1-96 debug2:MAC 库存: hmac-sha2-256-etm@openssh.com,hmac-sha2-256,hmac-sha1,hmac-sha1-96 debug2:压缩 ctos:无 debug2:压缩 stoc:无 debug2: 语言 ctos: debug2: 语言 stoc: debug2: first_kex_follows 0 debug2:保留 0 debug1:kex:算法: curve25519-sha256@libssh.org debug1:kex:主机密钥算法:ssh-rsa 调试1:kex:服务器->客户端密码:aes128-ctr MAC: hmac-sha2-256-etm@openssh.com 压缩:无 debug1:kex: 客户端->服务器密码:aes128-ctr MAC:hmac-sha2-256-etm@openssh.com 压缩:无调试3:发送数据包:类型30调试1:期待 SSH2_MSG_KEX_ECDH_REPLY debug3:接收数据包:类型 31 debug1:服务器 主机密钥:ssh-rsa SHA256:zzXQOXSRBEiUtuE8AikJYKwbHaxvSc0ojez9YXaGp1A debug3:hostkeys_foreach:读取文件“/home/coffee/.ssh/known_hosts” debug3:record_hostkey:在文件中找到密钥类型 RSA /home/coffee/.ssh/known_hosts:1 debug3: load_hostkeys: 加载 1 个密钥 来自 bitbucket.org debug3:hostkeys_foreach:读取文件 “/home/coffee/.ssh/known_hosts” debug3:record_hostkey:找到密钥类型 RSA 文件 /home/coffee/.ssh/known_hosts:4 debug3: load_hostkeys: 从 104.192.143.2 debug1 加载 1 个密钥:已知主机 'bitbucket.org' 并匹配 RSA 主机密钥。 debug1:找到密钥 /home/coffee/.ssh/known_hosts:1 debug3:发送数据包:类型 21 debug2: set_newkeys:模式 1 调试 1:在 4294967296 块后重新设置密钥调试 1: SSH2_MSG_NEWKEYS 发送 debug1:期待 SSH2_MSG_NEWKEYS debug3: 接收数据包:类型 21 debug2:set_newkeys:模式 0 debug1:rekey 在 4294967296 块后 debug1: SSH2_MSG_NEWKEYS 收到 debug2: key: /home/coffee/.ssh/id_rsa (0x560e427ce090),代理 debug2: key: /home/coffee/.ssh/id_dsa ((nil)) debug2: key: /home/coffee/.ssh/id_ecdsa ((nil)) debug2: key: /home/coffee/.ssh/id_ed25519 ((nil)) debug3: 发送数据包: type 5 debug3:接收数据包:类型 6 debug2:service_accept:ssh-userauth debug1:SSH2_MSG_SERVICE_ACCEPT 收到 debug3:发送数据包:类型 50 debug3:接收数据包:类型 51 debug1:认证可以 继续:publickey debug3:重新开始,传递了不同的列表 公钥调试3:首选 gssapi-keyex,gssapi-with-mic,publickey,keyboard-interactive,密码 debug3:authmethod_lookup publickey debug3:保持首选: 交互式键盘,密码调试3:authmethod_is_enabled publickey debug1:下一个认证方法:publickey debug1:提供RSA 公钥:/home/coffee/.ssh/id_rsa debug3: send_pubkey_test debug3: 发送数据包:类型 50 debug2:我们发送了一个公钥数据包,等待 回复调试3:接收数据包:类型60调试1:服务器接受密钥: pkalg ssh-rsa blen 279 debug2: input_userauth_pk_ok: fp SHA256:D24jvbjnHDP1iBckX6x4xv861x6AL/DbEwW0asiYUG8 调试3: sign_and_send_pubkey:RSA SHA256:D24jvbjnHDP1iBckX6x4xv861x6AL/DbEwW0asiYUG8 调试3:发送 数据包:类型 50 debug3:接收数据包:类型 52 debug1:身份验证 成功(公钥)。已通过 bitbucket.org 认证 ([104.192.143.2]:22)。调试1:通道0:新的[客户端会话]调试3: ssh_session2_open:channel_new:0 debug2:通道0:发送打开debug3: 发送数据包:类型 90 debug1:进入交互式会话。调试1: 承诺:网络调试3:接收数据包:类型91调试2:回调开始 debug2:fd 3 设置 TCP_NODELAY debug3:ssh_packet_set_tos:设置 IP_TOS 0x10 debug2:client_session2_setup:id 0 debug2:通道 0: 请求 pty-req 确认 1 debug3:发送数据包:类型 98 debug1:发送 环境。 debug3:忽略 env XDG_VTNR debug1:发送 env LC_PAPER = lv_LV.UTF-8 debug2:通道 0:请求 env 确认 0 debug3:发送数据包:类型 98 debug1:发送 env LC_ADDRESS = lv_LV.UTF-8 debug2: 通道 0:请求 env 确认 0 debug3:发送数据包:类型 98 debug3: 忽略了环境 XDG_SESSION_ID 调试3:忽略了环境 XDG_GREETER_DATA_DIR debug1:发送 env LC_MONETARY = lv_LV.UTF-8 debug2:通道 0: 请求 env 确认 0 debug3:发送数据包:类型 98 debug3:忽略 env CLUTTER_IM_MODULE 调试3:忽略环境会话调试3:忽略环境 GPG_AGENT_INFO debug3:忽略环境 TERM debug3:忽略环境 VTE_VERSION debug3:忽略环境 XDG_MENU_PREFIX debug3:忽略环境 SHELL debug3:忽略了 env QT_LINUX_ACCESSIBILITY_ALWAYS_ON debug3: 忽略 env WINDOWID debug1:发送 env LC_NUMERIC = lv_LV.UTF-8 debug2:通道 0:请求 env 确认 0 debug3:发送数据包:类型 98 debug3:忽略 env OLDPWD debug3:忽略 env UPSTART_SESSION debug3: 忽略了 env GNOME_KEYRING_CONTROL debug3:忽略了 env GTK_MODULES debug3:忽略 env USER debug3:忽略 env LS_COLORS debug3:忽略 env QT_ACCESSIBILITY debug1:发送 env LC_TELEPHONE = lv_LV.UTF-8 debug2:通道 0:请求 env 确认 0 debug3:发送数据包:类型 98 调试3:忽略环境 XDG_SESSION_PATH 调试3:忽略环境 XDG_SEAT_PATH debug3:忽略 env SSH_AUTH_SOCK debug3:忽略 env SESSION_MANAGER debug3:忽略 env DEFAULTS_PATH debug3:忽略 env XDG_CONFIG_DIRS debug3:忽略 env DESKTOP_SESSION debug3:忽略 env PATH debug3: 忽略了 env QT_IM_MODULE debug3:忽略了 env QT_QPA_PLATFORMTHEME debug1:发送 env LC_IDENTIFICATION = lv_LV.UTF-8 debug2:通道 0: 请求 env 确认 0 debug3:发送数据包:类型 98 debug3:忽略 env XDG_SESSION_TYPE debug3:忽略 env PWD debug3:忽略 env JOB debug3: 忽略了 env XMODIFIERS debug3: 忽略了 env GNOME_KEYRING_PID debug1:发送 env LANG = en_US.UTF-8 debug2:通道 0:请求 env 确认 0 debug3:发送数据包:类型 98 debug3:忽略 env GDM_LANG debug3:忽略 env MANDATORY_PATH debug1:发送 env LC_MEASUREMENT = lv_LV.UTF-8 debug2:通道 0:请求 env 确认 0 debug3:发送数据包:类型 98 debug3:忽略 env COMPIZ_CONFIG_PROFILE debug3: 忽略 env IM_CONFIG_PHASE debug3:忽略 env GDMSESSION debug3: 忽略 env SESSIONTYPE debug3:忽略 env GTK2_MODULES debug3: 忽略的环境 SHLVL debug3:忽略的 env HOME debug3:忽略的 env XDG_SEAT debug3:忽略的环境 LANGUAGE debug3:忽略的环境 GNOME_DESKTOP_SESSION_ID debug3:忽略 env UPSTART_INSTANCE debug3: 忽略了环境 UPSTART_EVENTS 调试 3:忽略了环境 XDG_SESSION_DESKTOP debug3:忽略 env LOGNAME debug3:忽略 env COMPIZ_BIN_PATH 调试3:忽略环境 DBUS_SESSION_BUS_ADDRESS 调试3:忽略环境 XDG_DATA_DIRS 调试3:忽略环境 QT4_IM_MODULE 调试3:忽略环境 LESSOPEN debug3:忽略了 env INSTANCE debug3:忽略了 env UPSTART_JOB 调试3:忽略环境 XDG_RUNTIME_DIR 调试3:忽略环境显示 debug3:忽略环境 XDG_CURRENT_DESKTOP debug3:忽略环境 GTK_IM_MODULE debug3:忽略 env LESSCLOSE debug1:发送 env LC_TIME = lv_LV.UTF-8 debug2:通道 0:请求 env 确认 0 debug3: 发送数据包:类型 98 debug1:发送 env LC_NAME = lv_LV.UTF-8 debug2: 通道 0:请求 env 确认 0 debug3:发送数据包:类型 98 debug3: 忽略 env XAUTHORITY debug3:忽略 env_debug2:通道 0: 请求外壳确认 1 debug3:发送数据包:类型 98 debug2:回调 完成调试2:通道0:打开确认rwindow 2097152 rmax 32768 debug3:接收数据包:类型 100 debug2:channel_input_status_confirm: 类型 100 id 0 PTY 分配请求在通道 0 调试 3 上失败: 接收数据包:类型 99 debug2:channel_input_status_confirm:类型 99 id 0 debug2:在通道 0 上接受的 shell 请求登录为 咖啡迷。

您可以使用 git 或 hg 连接到 Bitbucket。外壳访问是 禁用。 debug3:接收数据包:类型 98 debug1: client_input_channel_req:通道 0 rtype 退出状态回复 0 debug3: 接收数据包:类型 96 debug2:通道 0:rcvd eof debug2:通道 0: 输出打开 -> 漏 debug2:通道 0:obuf 空 debug2:通道 0: close_write debug2:通道 0:输出漏 -> 关闭 debug3:接收 数据包:类型 97 debug2:通道 0:rcvd 关闭 debug2:通道 0: close_read debug2:通道 0:输入打开 -> 关闭 debug3:通道 0: 关闭 debug2 后不会发送数据:通道 0:几乎死 debug2: 通道 0:gc:通知用户 debug2:通道 0:gc:用户分离 debug2:通道 0:发送关闭 debug3:发送数据包:类型 97 debug2: 通道 0:已死调试 2:通道 0:垃圾收集调试 1: 通道 0:免费:客户端会话,nchannels 1 debug3:通道 0: 状态:以下连接已打开:#0 客户端会话(t4 r0 i3/0 o3/0 fd -1/-1 cc -1)

debug3:发送数据包:类型 1 与 bitbucket.org 的连接已关闭。 已传输:发送 3508,接收 1836 字节,在 0.3 秒内 Bytes per 第二:发送12053.3,接收6308.4 debug1:退出状态0

【问题讨论】:

  • 你能运行ssh -vvv git@bitbucket.org并更新日志吗
  • @PseudoAj 完成。

标签: git bitbucket


【解决方案1】:

您无法在 GitHub、Bitbucket、GitLab 等大多数服务上运行原始的 ssh 命令:

您可以使用 git 或 hg 连接到 Bitbucket。 Shell 访问已禁用。

此消息表明您已成功连接到 Bitbucket。但是,他们不为git 用户使用bash 或其他shell。他们可能会改用自定义的git-shell,它只允许使用git 命令。

使用git clone git@bitbucket.org/path/to/your/repository 而不是ssh。请记住,您必须事先创建存储库。

【讨论】:

  • @YawningMilk 不,这是 a) 没有必要的,b) 将使所有所有者的存储库对您可用。我猜当时是配置错误。
  • 我的错,我一直在尝试做 sudo git clone。没有 sudo 一切正常
  • instead ofssh
【解决方案2】:

首先,创建一个SSH Key:

https://support.atlassian.com/bitbucket-cloud/docs/set-up-an-ssh-key/

然后,将新的 SSH 公钥粘贴到来自 Bitbucket 的个人资料设置中:

https://confluence.atlassian.com/bbkb/permission-denied-publickey-302811860.html

简单易懂!

【讨论】:

  • 每当我看到“easy peasy”或什至只是“simply”时,我都会沸腾。我也有同样的问题。设置一个新分支,获取和结帐的命令会出现权限错误。它适用于旧分支,但不适用于新分支。解决方法是“简单地”运行 git fetch。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-12-30
  • 2019-10-22
  • 2015-05-10
  • 2019-11-23
  • 2012-10-24
  • 1970-01-01
相关资源
最近更新 更多