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
Ubuntu bitbucket,ssh密钥不能有id_rsa以外的名称_Ubuntu_Ssh_Bitbucket - Fatal编程技术网

Ubuntu bitbucket,ssh密钥不能有id_rsa以外的名称

Ubuntu bitbucket,ssh密钥不能有id_rsa以外的名称,ubuntu,ssh,bitbucket,Ubuntu,Ssh,Bitbucket,如果我的密钥名为id_rsa.pub,并将其放入bitbucket ssh设置中。它是开箱即用的。当我使用像id_rsa_else.pub这样的ssk密钥根名称时,请插入到ssh密钥设置中。它在说 repository access denied. fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.

如果我的密钥名为id_rsa.pub,并将其放入bitbucket ssh设置中。它是开箱即用的。当我使用像id_rsa_else.pub这样的ssk密钥根名称时,请插入到ssh密钥设置中。它在说

repository access denied.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
更新1

下面给出了上述错误:

Host andatech_bitbucket_my_username
  HostName bitbucket.org
  User andatech_my_username
  IdentityFile ~/.ssh/andatech_my_username_bitbucket

将以下内容添加到ssh配置文件中。 通常是文件:~/.ssh/config


id\u rsa\u else是您的密钥的名称。这会告诉ssh在与bitbucket.org交谈时要使用哪个私钥。

您的回购协议上的遥控器是作为andatech_bitbucket_my_用户名还是作为bitbucket.org列出的?您可以运行git remote get url origin来查看远程命名源的url。如果URL的第一部分不是andatech_bitbucket_my_用户名,那么SSH不会在配置中引用该节,因此它不会使用您想要的密钥

如果这是问题所在,那么您可以通过以下两种方式之一进行修复:要么更新repos以使用andatech_bitbucket_my_用户名,而不是git@bitbucket.org或者你在那里列出的git remote set url来源和Tech\u bitbucket\u我的用户名,或者更新你的~/.ssh/config,让主机bitbucket.org代替主机andatech_bitbucket_my_用户名


基于此:

git还是mercurial?我目前正在使用git。以下是一些可能的解决方案:bitbucket的用户名应该是git,而不是andatech\u0。另外:您是否将andatech\u my\u username\u bitbucket密钥添加到bitbucket中。因为在问题的开头,你说的是id_rsa_else作为密钥的名称。以下不起作用:有点模糊。。。到目前为止,我上面的评论看起来不错。它有用吗?如果没有,那么运行ssh-Tvv时会发生什么git@bitbucket.org?
Host bitbucket.org
  IdentityFile ~/.ssh/id_rsa_else
Host bitbucket.org 
  HostName bitbucket.org
  PreferredAuthentications publickey
  IdentityFile ~/.ssh/andatech_xxx_bitbucket