如何修复警告:无法访问身份文件 github:没有这样的文件或目录?

fre*_*inn 8 ssh git github

Host github.com git 
  HostName github.com
  User git
  IdentityFile ~/.ssh/github # I've tried also /home/freinn/.shh/github
Run Code Online (Sandbox Code Playgroud)

没有/home/freinn/github创建文件,我必须创建它吗?

这是完整的警告:

Warning: Identity file /home/freinn/github not accessible: No such file or directory.
Hi freinn! You've successfully authenticated, but GitHub does not provide shell access.

[freinn@freinn ruby]$ ssh -v git@github
OpenSSH_5.9p1, OpenSSL 1.0.0j-fips 10 May 2012
debug1: Reading configuration data /home/freinn/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 50: Applying options for *
ssh: Could not resolve hostname github: Name or service not known
Run Code Online (Sandbox Code Playgroud)

col*_*ons 1

要在 GitHub 上使用 SSH 身份验证,您需要按照GitHub 的说明创建公钥/私钥对。该IdentityFile选项应指向包含您在执行这些指令时创建的私钥的任何文件。

\n\n

无论如何,看起来您连接得很好* \xe2\x80\x94 您正在看到 GitHub 的成功连接消息。也许你的 GitHub 私钥只是~/.ssh/id_rsa?如果是这样,您可以IdentityFile完全删除该行,它将按预期工作。

\n\n

如果有任何帮助,我的相关部分~/.ssh/config/如下所示:

\n\n
Host github.com\n    IdentityFile ~/.ssh/id_rsa_github\n    IdentitiesOnly yes\n
Run Code Online (Sandbox Code Playgroud)\n\n

\xe2\x80\xa6but 这只有效,因为~/.ssh/id_rsa_github这是我放置 GitHub 特定的 RSA 私钥的位置。

\n\n

*当您从 shellYou\'ve successfully authenticated, but GitHub does not provide shell access.成功进入时, GitHub 始终会响应。ssh

\n