Windows上ssh配置中声明的主机不可见
我在Windows上使用Git和Git Bash 在Windows上ssh配置中声明的主机不可见,windows,git,ssh,Windows,Git,Ssh,我在Windows上使用Git和Git Bash 在C:\Users\myuser\.ssh中,我创建了一个config文件,其中声明了一个主机 主机我的主机以及一些配置 配置文件包含以下内容: Host my-host User my-username Hostname my-repo.com Port 7999 IdentityFile id_rsa 理论上,我应该能够从命令行连接到此主机: ssh我的主机 但是,这不会发生,
C:\Users\myuser\.ssh
中,我创建了一个config
文件,其中声明了一个主机
主机我的主机
以及一些配置
配置文件包含以下内容:
Host my-host
User my-username
Hostname my-repo.com
Port 7999
IdentityFile id_rsa
理论上,我应该能够从命令行连接到此主机:
ssh我的主机
但是,这不会发生,如果尝试从Git Bash运行此命令,我会得到:
ssh: Could not resolve hostname my-host: Name or service not known
那么,如何使此主机在Git Bash或Windows命令行中可见呢?- 检查端口号,7999不适用于ssh
- 设置id\u rsa的完整路径,如~/.ssh/id\u rsa
- 也许您应该使用不带“-”的别名
- 使用不带别名的参数检查连接,如“ssh-i~/.ssh/id\u rsa-p7999user@host"
- 检查你的身份证,是私钥吗
- 检查文件夹和文件的权限:~/.ssh-700、~/.ssh/config-600