git - ssh配置格式

标签 git github ssh

我遵循了一个教程,所以我可以在同一台机器上有两个单独的 git hub 用户,我在 ssh 文件夹中创建了一个配置:

#Default GitHub
Host <span class="skimlinks-unlinked">github.com</span>
HostName <span class="skimlinks-unlinked">github.com</span>
User git
IdentityFile ~/.ssh/id_rsa
Host github-panthro
HostName <span class="skimlinks-unlinked">github.com</span>
User git
IdentityFile ~/.ssh/id_rsa_panthro

但是现在当我尝试使用 ssh 时,我得到了错误:

config line 3: garbage at end of line; "class".

我已经清理了删除空格的类,但错误仍然存​​在。

最佳答案

按如下方式删除 Span,它应该可以工作。我有类似的配置文件。

Host github.com
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa
Host github-panthro
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa_panthro

关于git - ssh配置格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25442612/

相关文章:

linux - 安装 Big Insight 时出现无密码 SSH 错误

node.js - 为什么每个 POST 请求都会多次触发 shell 命令而不是一次。我正在使用 nodejs 和 simple-ssh Node 模块

git - git pull 和 git fetch + git rebase 有什么区别?

git - 编写一个 git post-receive hook 来处理特定的分支

git - 删除一对旧的 git 提交

ruby-on-rails - Git 标记和 rails gemfile

linux - 无法从 gcloud 克隆到 git : "Could not find gcloud' s git credential helper.“

Git diff 所有本地未提交的更改

github - "go get"之后的 GO 命令行问题

go - 如何在 Go 中为 SSH 生成 ECDSA key 对?