Problem scenario
You are running an SSH git command (to interact with GitLab, GitHub or some Git repository), but you get "No such host is known" message. What should you do to troubleshoot this problem?
Possible Solution #1
Use "git clone git@gitserver.acme.com" (instead of "ssh git@gitserver.acme.com"; you need to use the git command first).
Possible Solution #2
Try to ping gitserver.acme.com. If that fails, you may want to proceed with troubleshooting that (e.g., a DNS connection problem, ICMP packets could be blocked, or there is a firewall rule preventing resolution to this server). If the ping works, retype the original git command carefully.
Possible Solution #3
Verify the /etc/hosts file is working correctly. You may want to look at the /etc/resolv.conf file to see if it has an entry for a valid DNS server (such as 8.8.8.8, a common one).
Solution adapted from these postings:
https://stackoverflow.com/questions/9393409/ssh-could-not-resolve-hostname-github-com-name-or-service-not-known-fatal-th
https://kuttler.eu/en/post/git-clone-ssh-could-not-resolve-hostname/
Possible Solution #4
On a non-Windows system, you could do this to get more information:
GIT_CURL_VERBOSE=1 GIT_TRACE=1 git clone ssh://git@gitserver.acme.com:foobarteam/foobar.git
(This was adapted from this atlassian.com website.)