Could not resolve hostname for GitLab

Viewed 7062

So I just created a GitLab project and installed Git for windows, and after I generated/set up my ssh keys, the testing isn't successful:

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.

I went to my git folder, created a .ssh directory and generated my keys in there (public and private).

What did i do wrong ?

Thanks in advance !

2 Answers

Thanks for your help. I created the conf file in a .ssh folder in %USERPROFILE% as you said, but when i run the test command, it says:

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.

(an unfetchable error has occured while browsing the database, sorry if the translation is not correct)

Here is the content of my config file:

Host Random-nii-chan
    Hostname git@Random-nii-chan
    User git
    IdentityFile C:\DiscordBot\SillyBot\.ssh\gitlab

I edited it with the nano command

First, ssh does not look for your keys in "your git folder", but in %USERPROFILE%, in your case C:\Users\Random-nii-chan

Second, make sure you have a C:\Users\Random-nii-chan.ssh\config file (no extension, with LF end of lines, not CRLF) where you define what random-nii-chan is:

Host random-nii-chan
   Hostname yourGitLabserver.com
   User git
   IdentityFile c:/path/to/your/private/key

Then you can try ssh -Tv random-nii-chan (no need to add git@: the User is specified in the config file)

Related