add custom domain resolution in linux(could not resolve hostname error fix)
Problem
when the local machine is having problems resolving domain name. This can happen when using domain names that are not public but setup in corporate intranet setups.
Below is an example error message that I got when trying to git clone from corporate github which is not open to public and only accessable through intranet.
$ git clone git@somegithub.com:someuser/somereponame
Cloning into 'somereponame'…
ssh: Could not resolve hostname somegithub.com: Temporary failure in name resolution
Solution
Get the ip address of the private domain name and add it to /etc/hosts
. Below is an example
\# inside /etc/hosts
1.2.3.4 somegithub.com
After this, I retried the git clone and now it can communicate with somegithub.com
.