Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
添加公钥Bitbucket后拒绝git克隆存储库访问_Git_Ssh - Fatal编程技术网

添加公钥Bitbucket后拒绝git克隆存储库访问

添加公钥Bitbucket后拒绝git克隆存储库访问,git,ssh,Git,Ssh,我试图通过ssh访问我的bitbucket帐户上的存储库,但无论我尝试什么,我似乎都无法访问。我也拥有我帐户上的所有存储库,因此这不是没有读/写权限的问题 我创建了一个新的公钥/私钥组合,并将公钥添加到我的帐户中(我在其他计算机上也这样做了)。我在命令行中执行了以下命令: eval 'ssh-agent' //I've also tried eval 'ssh-agent -s' ssh-add /path/to/private/key 仍然拒绝访问。我以前在Bitbucket上安装过SSH访

我试图通过ssh访问我的bitbucket帐户上的存储库,但无论我尝试什么,我似乎都无法访问。我也拥有我帐户上的所有存储库,因此这不是没有读/写权限的问题

我创建了一个新的公钥/私钥组合,并将公钥添加到我的帐户中(我在其他计算机上也这样做了)。我在命令行中执行了以下命令:

eval 'ssh-agent' //I've also tried eval 'ssh-agent -s'
ssh-add /path/to/private/key
仍然拒绝访问。我以前在Bitbucket上安装过SSH访问,使用相同的过程没有任何问题,但由于某些原因,我无法让它工作

更新:

我运行了ssh-v bitbucket.org,结果如下:

OpenSSH_7.2p2 Ubuntu-4ubuntu2.7, OpenSSL 1.0.2g  1 Mar 2016
debug1: Reading configuration data /home/eric/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to bitbucket.org [18.205.93.0] port 22.
debug1: Connection established.
debug1: identity file /home/eric/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /home/eric/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/eric/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/eric/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/eric/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/eric/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/eric/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/eric/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.7
debug1: Remote protocol version 2.0, remote software version conker_1.1.53-1da6f80 app-155
debug1: no match: conker_1.1.53-1da6f80 app-155
debug1: Authenticating to bitbucket.org:22 as 'eric'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256@libssh.org
debug1: kex: host key algorithm: ssh-rsa
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ssh-rsa SHA256:zzXQOXSRBEiUtuE8AikJYKwbHaxvSc0ojez9YXaGp1A
debug1: Host 'bitbucket.org' is known and matches the RSA host key.
debug1: Found key in /home/eric/.ssh/known_hosts:1
Warning: Permanently added the RSA host key for IP address '18.205.93.0' to the list of known hosts.
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/eric/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Offering RSA public key: eric@thanos
debug1: Authentications that can continue: publickey
debug1: Offering RSA public key: eric@thanos
debug1: Authentications that can continue: publickey
debug1: Trying private key: /home/eric/.ssh/id_dsa
debug1: Trying private key: /home/eric/.ssh/id_ecdsa
debug1: Trying private key: /home/eric/.ssh/id_ed25519
debug1: No more authentication methods to try.
Permission denied (publickey).
OpenSSH_7.2p2 Ubuntu-4ubuntu2.7,OpenSSL 1.0.2g 2016年3月1日
debug1:正在读取配置数据/home/eric/.ssh/config
debug1:读取配置数据/etc/ssh/ssh\u config
debug1:/etc/ssh/ssh\u配置第19行:应用*
debug1:连接到bitbucket.org[18.205.93.0]端口22。
debug1:已建立连接。
debug1:identity file/home/eric/.ssh/id\u rsa类型1
debug1:key\u load\u public:没有这样的文件或目录
debug1:identity file/home/eric/.ssh/id\u rsa-cert类型-1
debug1:key\u load\u public:没有这样的文件或目录
debug1:identity file/home/eric/.ssh/id_dsa type-1
debug1:key\u load\u public:没有这样的文件或目录
debug1:identity file/home/eric/.ssh/id_dsa-cert type-1
debug1:key\u load\u public:没有这样的文件或目录
debug1:identity file/home/eric/.ssh/id_ecdsa type-1
debug1:key\u load\u public:没有这样的文件或目录
debug1:identity file/home/eric/.ssh/id_ecdsa-cert type-1
debug1:key\u load\u public:没有这样的文件或目录
debug1:identity file/home/eric/.ssh/id_ed25519 type-1
debug1:key\u load\u public:没有这样的文件或目录
debug1:identity file/home/eric/.ssh/id_ed25519-cert type-1
debug1:启用协议2.0的兼容模式
debug1:本地版本字符串SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.7
调试1:远程协议版本2.0,远程软件版本conker_1.1.53-1da6f80 app-155
调试1:不匹配:conker_1.1.53-1da6f80 app-155
debug1:正在以“eric”身份向bitbucket.org:22进行身份验证
debug1:SSH2\u MSG\u KEXINIT已发送
debug1:SSH2\u MSG\u KEXINIT已收到
debug1:kex:算法:curve25519-sha256@libssh.org
debug1:kex:主机密钥算法:ssh-rsa
debug1:kex:server->client cipher:chachacha20-poly1305@openssh.comMAC:压缩:无
debug1:kex:client->server cipher:chachacha20-poly1305@openssh.comMAC:压缩:无
debug1:需要SSH2\u MSG\u KEX\u ECDH\u回复
debug1:服务器主机密钥:ssh rsa SHA256:zzXQOXSRBEiUtuE8AikJYKwbHaxvSc0ojez9YXaGp1A
debug1:主机“bitbucket.org”是已知的,并且与RSA主机密钥匹配。
debug1:在/home/eric/.ssh/known_hosts中找到密钥:1
警告:已将IP地址“18.205.93.0”的RSA主机密钥永久添加到已知主机列表中。
debug1:在134217728块之后重新键入
debug1:SSH2\u MSG\u已发送新密钥
debug1:应为SSH2\u MSG\u NEWKEYS
debug1:SSH2\u MSG\u接收到新密钥
debug1:在134217728块之后重新键入
debug1:SSH2\u消息\u服务\u接收
debug1:可以继续的身份验证:公钥
debug1:下一个身份验证方法:公钥
debug1:提供RSA公钥:/home/eric/.ssh/id\u RSA
debug1:可以继续的身份验证:公钥
debug1:提供RSA公钥:eric@thanos
debug1:可以继续的身份验证:公钥
debug1:提供RSA公钥:eric@thanos
debug1:可以继续的身份验证:公钥
debug1:正在尝试私钥:/home/eric/.ssh/id\u dsa
debug1:正在尝试私钥:/home/eric/.ssh/id\u ecdsa
debug1:正在尝试私钥:/home/eric/.ssh/id_ed25519
debug1:不再尝试验证方法。
权限被拒绝(公钥)。

看起来它正在试图找到一个名为id_rsa的私钥,对于我现在正在使用的计算机,它已经在另一个bitbucket帐户上使用,因此无法用于此帐户。是否有某种方法可以覆盖该命名约定,以便我可以添加一个未命名为id_rsa的自定义密钥?

首先,使用不带密码短语的私钥尝试一下:您将避免处理ssh代理,这对于测试来说更容易

第二,确保为以下对象生成私钥:

看看问题是否依然存在

堆栈跟踪还包括:


确保您的SSH URL是
git@bitbucket.org
,而不是
eric@bitbucket.org
:密钥用于在会话中对您进行身份验证,但会话始终使用
git
帐户打开。

首先,使用不带密码短语的私钥进行尝试:您将避免处理ssh代理,对于测试来说,这更容易

第二,确保为以下对象生成私钥:

看看问题是否依然存在

堆栈跟踪还包括:


确保您的SSH URL是
git@bitbucket.org
,而不是
eric@bitbucket.org
:密钥在会话中用于验证您的身份,但会话始终使用
git
帐户打开。

我找到了问题的原因。默认情况下,bitbucket在使用默认git url(
git@bitbucket.org:/.git
)。由于我的帐户已经与另一个帐户绑定,所以它不断抛出错误。但是,可以使用以下信息向帐户添加其他密钥:


为我工作,现在我可以通过SSH访问我的帐户。

我找到了导致问题的原因。默认情况下,bitbucket在使用默认git url(
git@bitbucket.org:/.git
)。由于我的帐户已经与另一个帐户绑定,所以它不断抛出错误。但是,可以使用以下信息向帐户添加其他密钥:


为我工作,现在我有SSH访问我的帐户。

你能提供更多信息吗?你可以执行ssh-v bitbucket.org之类的东西,我想应该是
ssh-keygen -m PEM -t rsa -P "" -f afile
Authenticating to bitbucket.org:22 as 'eric'