Search

Wednesday, 3 May 2023

git clone error - fatal: unable to access Could not resolve host: github.com

Command Used

git clone https://github.com/ajgupta23/Realtime-Cloudwatch-Log-analytics-using-Kafka-and-Spark-Streaming.git

Error

Cloning into 'Realtime-Cloudwatch-Log-analytics-using-Kafka-and-Spark-Streaming'...

fatal: unable to access 'https://github.com/ajgupta23/Realtime-Cloudwatch-Log-analytics-using-Kafka-and-Spark-Streaming.git/': Could not resolve host: github.com

Solution

In some cases, proxies can interfere with network connectivity and cause issues with DNS resolution, which could explain the error message "Could not resolve host: github.com".

the below command removes any proxy settings that may have been configured for Git, which could have been preventing Git from resolving the host name for GitHub.

If you no longer need to use a proxy for your Git operations, then it's safe to remove the proxy settings using the below commands.

For http: git config --global --unset http.proxy

For https: git config --global --unset https.proxy