2

I am following this page on how to test ssh connection.

When i enter this first line:

$ ssh -T git@hostname

I get an error:

ssh: could not resolve hostname 
hostname: Temporary failure in name resolution
torek
  • 448,244
  • 59
  • 642
  • 775
J-Storm9
  • 21
  • 1
  • 1
  • 2
  • Note that by testing with ssh, you take Git completely out of the picture (which is a good thing, it reduces the complications by quite a bit). This proves that the problem is not related to Git. – torek Aug 31 '22 at 05:43

1 Answers1

1

Make sure you can ping hostname, meaning your DNS does resolve hostname into an IP address.

If not, then SSH would fold back to ~/.ssh/config, looking for a Host hostname entry which would indicate what 'hostname' actually means.

Of course, replace 'hostname' by the actual remote host name you want to reach with this SSH session.

After that, it depends on your OS (Windows, Linux, ...), both for the source and the target.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • ping hostname returns this: ping request could not find host hostname. please check name and try again. I went to my .ssh/ and there is no config file. – J-Storm9 Sep 03 '22 at 22:26
  • @J-Storm9 Do this is a DNS first issue (before SSH). You need to make sure the hostname can be resolved, or try its IP address directly. – VonC Sep 03 '22 at 22:38
  • @J-Storm9 If the IP passes, then you can add it to your [`/etc/hosts`file](https://stackoverflow.com/a/62339310/6309). – VonC Sep 03 '22 at 22:54
  • how do i go about resolving the hostname? – J-Storm9 Sep 03 '22 at 22:55
  • @J-Storm9 First, it depends on the nature of your source and destination server (OS? Version? Git version?). Second, a typical test to check if the network route is opened is `curl -v telnet://hostname:22` (replacing hostname by the actual target host name, of course). If you know its IP address, you can do the same test with IP instead of hostname. – VonC Sep 03 '22 at 22:57