- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
我试图了解 .ssh/config 和 .git/config 下的配置如何交互。
情况是这样的:我有两个独立的 github 帐户,我们称它们为 GH0 和 GH1,我想与这两个“无密码”交互,即使用 ~/.ssh/id_rsa.GH0 中的 ssh key 。 pub
和 ~/.ssh/id_rsa.GH1.pub
。目前这适用于 GH0 但不适用于 GH1。 (例如,对 GH1 的 push
命令因 ERROR: Repository not found.\nfatal: The remote end unexpectedly hang unexpectedly.
; ssh -T git@github.com
有效,但只是因为它连接 GH0
。)
这意味着对于这些 github 帐户中的每一个,我都必须在 ~/.ssh/config 中有一个相应的部分,指定要用于它的 ssh key 文件。 (例如,GH0 部分将包含类似 IdentityFile ~/.ssh/id_rsa.GH0
等内容)
问题是:我还必须在每个部分中添加什么?更具体地说,
what do I have to put as the argument to the
Host
keyword in~/.ssh/config
?
到目前为止,我发现的这方面的信息对我来说毫无意义。在某些示例中,我看到类似
Host github.com
Hostname github.com
User git
IdentityFile ~/.ssh/id_rsa
Host ac2.github.com
Hostname github.com
User git
IdentityFile ~/.ssh/id_rsa_ac2
那个“ac2”在哪里?第二个 Host
中的前缀来自???
Where do I find the corresponding ones for my github accounts?
我发现的一些信息让人猜测 Host
关键字的参数实际上是任意的,这意味着下面的参数也可以
Host omgwtfbbq
Hostname github.com
User git
IdentityFile ~/.ssh/GH0
Host 4.8.15.16.23.42
Hostname github.com
User git
IdentityFile ~/.ssh/GH1
但如果是这样,这又引发了另一个问题:git
(或 github)如何知道将这两个部分中的哪一个用于任何给定命令?
同样,我猜测1 这将在项目的 .git/config
文件中指定,在某些 [remote ...]
部分,但是如何呢?
1我必须求助于猜测,因为一方面,我无法在 .git/config 中找到解释键值对的文档。我找到的最接近的是 git-config 的手册页,但我无法在此页面中找到 [remote .. .]
部分。 git-remote 的手册页也没有关于此字段的文档。
最佳答案
执行以下操作:
$ git remote add omgwtfbbq git@omgwtfbbq:user/repo.git
$ git pull omgwtfbbq master
这将使用您在 ~/.ssh/config
中定义的 Host
别名作为 git 主机,因此将使用您设置的 IdentityFile .
关于git - 多个 github 帐户 : what values for Host in . ssh/config?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14689788/
Windows“主机”文件编码是什么?是UTF-8吗?还是 ASCII + 系统代码页?应如何添加 IDN(带有变音符号等的国际域名)条目以及它们是否可以添加? 最佳答案 它应该是没有 BOM 的 A
我已经在谷歌上搜索了大约 90 分钟,但仍然没有答案。在哪里设置 default_url_options?我已经将其设置为 config.action_mailer.default_url_optio
我正在从它的样式文件中设计一个 Angular 组件,我发现我必须使用 :host ,:host() 或 :host-context selector ,它们各自有什么不同? 最佳答案 :主机 是用于
我正在创建简单的网络应用程序。而且我在服务器配置方面遇到了问题。当我尝试启动服务器时,收到错误消息 The element type "Host"must be terminated by the m
这个有效: 127.0.0.1 www.somesite.com 但不是这个: 127.0.0.1/somepath/www www.mysite.com 我做错了什么?是否可
我必须查看我的前同事留下的一些脚本,我很好奇为什么他在参数中使用 $a = $(Read-Host -Prompt "Write Something")节而不是 $a = (Read-Host -Pr
我在远程连接到 MySQL 服务器时遇到问题。我知道我的用户设置了来自任何主机的“%”通配符,因此我应该有权访问服务器。我可以使用我的凭据本地登录 MySQL 服务器,但不能远程登录。 我在 my.c
我正在尝试使用 angular 2 构建一个双主题应用程序。有问题的组件 css 已经使用 :host/deep/强制对子组件进行样式设置。 但是我正在尝试根据 html 主题切换此样式,并且我正在使
我需要将特定的传出连接(从我系统上的任何 网络客户端)重定向到特定的 IP。是的,可以通过在 /etc/hosts 文件中添加这一行来完成: 123.456.789.012 www.mydomain
尝试在开发中预览我的邮件程序,但出现上述错误。(使用 Michael Hartl 教程)。 我相信它因为我的主机而无法正常工作。但是,使用 cloud 9 我很难找到我的主机。在书中,它被定义为 Cl
nc 当我在虚拟机上执行它时工作正常。 Connection to 10.0.0.10 22 port [tcp/ssh] succeeded! 但是当我在 docker 容器内执行相同的命令时,它会
我正在学习PowerShell,想知道两者之间的区别 Read-Host -Prompt "Text" 和 Read-Host "Text" 是同一件事还是我没有看到的区别? 最佳答案 这是同一件事。
我无法对 Cassandra 节点进行查询。我能够连接到集群并进行连接。然而,在执行查询时,它失败了 Caused by: com.datastax.driver.core.exceptions.No
我有这样的场景,比如我需要运行一个位于 12.34.567 的 API curl 请求,登录后我必须再登录一台主机 98.76.543。 登录到第二个主机后,我必须运行curl -XPOST -H"C
当我尝试 git push -u origin master到我的存储库,我得到 400 Bad Request .我特意用 编辑了一些信息。 最近从 gitlab-ee 中解绑了 nginx,并验
假设我有某个程序的源代码,源代码使用 GNU autotools,为了简单起见,假设该程序绝不是任何类型的开发工具。如果我手边有交叉工具链,我可以使用 --host configure 为平台 foo
在我的 ASP.NET Core 2.0 项目中,我一直在使用 Microsoft.Extensions.Hosting 命名空间中的 IHostingEnvironment 和 IApplicati
我正在使用以 Python3.6 为基础的 docker 镜像。突然间它开始崩溃(启动后立即退出)。所以我冲进了容器,发现它崩溃是因为与容器化 postgres 数据库的连接突然失败。我设法得到的唯一
已关闭。此问题不符合Stack Overflow guidelines 。目前不接受答案。 这个问题似乎不是关于 a specific programming problem, a software
我尝试使用 ssh命令连接到另一个远程主机。 ssh -p 21098 -i $OPENSHIFT_DATA_DIR/.ssh/host_key user@domain.com The authe
我是一名优秀的程序员,十分优秀!