SSH配置无法访问多个存储库 [英] SSH config to access multiple repo not working

查看:57
本文介绍了SSH配置无法访问多个存储库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是配置文件:

Host bitbucket.org
HostName bitbucket.org
User git
IdentityFile ~/.ssh/id_rsa

Host bitbucket-office.org
HostName bitbucket-off.org
User git
IdentityFile ~/.ssh/work_rsa

Host bitbucket-personal.org
HostName bitbucket-per.org
User git
IdentityFile ~/.ssh/personal_rsa

我不知道设置有什么问题.我想从同一台本地计算机连接到2个远程存储库.设置配置文件是我在互联网上找到的解决方案.但是以某种方式,我一次只能使用一个(一个是最新创建的).当我尝试从其他仓库中提取信息时,会引发以下错误:

I don't know what's wrong with set up. I want to connect to 2 remote repos from the same local machine. Setting up a config file was the solution I found over the internet. But somehow, I am just able to use one at a time (the one created latest). When I try to pull from other repo it throws the following error:

Agent admitted failure to sign using the key.
repository access denied.
fatal: The remote end hung up unexpectedly

我的两个公共SSH密钥都分别张贴在各自的Bitbucket帐户中.

Both my public SSH keys are well posted in respective bitbucket accounts.

如何使配置文件根据需要运行?

How do I make config file run as needed?

推荐答案

您的 HostName 设置错误.它们都应该是 bitbucket.org ,正如您通过此设置告诉您实际连接的位置.

Your HostName settings are wrong. They should all be bitbucket.org, as you tell with this setting where to actually connect to.

此外, Host 的设置应该缩进,但这可能只是此处的发布错误.如果看起来像已发布,则也应更改.据我所知,缩进非常重要且有意义.

Also there should be indentation for the settings for a Host, but this might just be a posting error here. If it looks like posted though, this should also be chnanged. As far as I remember, the indentation is important and meaningful.

这篇关于SSH配置无法访问多个存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆