Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Windows上ssh配置中声明的主机不可见_Windows_Git_Ssh - Fatal编程技术网

Windows上ssh配置中声明的主机不可见

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我的主机 但是,这不会发生,

我在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我的主机

但是,这不会发生,如果尝试从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

请显示配置文件内容我已经更新了问题。