所以我刚刚创建了一个 GitLab 项目并为 windows 安装了 Git,在我生成/设置我的 ssh key 之后,测试不成功:
C:\DiscordBot\SillyBot> ssh -vvvT git@Random-nii-chan
OpenSSH_for_Windows_7.6p1, LibreSSL 2.6.4
debug3: Failed to open file:C:\\Users\\Random-nii-chan/.ssh/config error:2
debug3: Failed to open file:C:\\ProgramData\\ssh/ssh_config error:2
debug2: resolving "random-nii-chan" port 22
C:\\WINDOWS\\System32\\OpenSSH\\ssh.exe: Could not resolve hostname random-nii-chan: Unknown host.
我去了我的 git 文件夹,创建了一个 .ssh 目录并在其中生成了我的 key (公共(public)和私有(private))。
我做错什么了 ?
提前致谢 !
最佳答案
谢谢你的帮助。正如你所说,我在 %USERPROFILE% 的 .ssh 文件夹中创建了 conf 文件,但是当我运行测试命令时,它说:
C:\DiscordBot\SillyBot>ssh -vvvT git@Random-nii-chan
OpenSSH_for_Windows_7.6p1, LibreSSL 2.6.4
debug1: Reading configuration data C:\\Users\\Random-nii-chan/.ssh/config
debug1: C:\\Users\\Random-nii-chan/.ssh/config line 1: Applying options for Random-nii-chan
debug3: Failed to open file:C:\\ProgramData\\ssh/ssh_config error:2
debug2: resolving "git@random-nii-chan" port 22
ssh: Could not resolve hostname git@random-nii-chan: Une erreur irr\351cup\351rable s\222est produite lors d\222une recherche sur la base de donn\351es.
(浏览数据库时出现无法获取的错误,如果翻译不正确,请见谅)
这是我的配置文件的内容:
Host Random-nii-chan
Hostname git@Random-nii-chan
User git
IdentityFile C:\DiscordBot\SillyBot\.ssh\gitlab
我用 nano 命令编辑了它
关于shell - 无法解析 GitLab 的主机名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53347413/