【发布时间】:2013-04-13 13:33:47
【问题描述】:
我正在尝试为多个 SSH 帐户(特别是 github.com)创建一个 .ssh/config 文件。我已经尝试了几个教程和 github 帮助演练,但似乎没有任何效果。
我创建了id_rsa_test 和id_rsa_test.pub。我上传了id_rsa_test.pub到github。
然后我创建了一个 ~/.ssh/config 文件,其中包含以下内容:
# github account
Host github.com-test github.com
Hostname github.com
User git
IdentifyFile ~/.ssh/id_rsa_test
和
# github account
Host github.com-test github.com
Hostname github.com
User git
IdentifyFile ~/.ssh/id_rsa_test.pub
然后我尝试了几个命令。即:
git clone git@github-test:username/my_project.git
git push
...每次我收到以下错误:
/home/username/.ssh/config: line 5: Bad configuration option: IdentifyFile
/home/username/.ssh/config: terminating, 1 bad configuration options
fatal: The remote end hung up unexpectedly
有什么建议吗?
【问题讨论】:
-
你太棒了!我忘记的一件事是 IdentityFile ~/.ssh/id_rsa_test.pub 谢谢! 每个人也不要忘记 .pub。
-
这个问题是由拼写错误造成的,应该以不可重现或由拼写错误引起的形式结束。也许新标题应该是 Github SSH Config: IdentityFile, not identifyFile
-
@TrentonMcKinney 我更新了标题以包含错误消息。 (我会在几周后删除这条评论。)
-
@wesleyfranks 不,IdentityFile 行中必须不有“.pub”后缀(这会导致以下错误之一:“WARNING: UNPROTECTED私钥文件!”,或“加载密钥“xxx.pub”:格式无效”)。