[Solved] Git: Could not resolve host error while cloning remote repository in git

What I did: I have created a remote repository on Github and I am trying to clone the remote repository on my local machine. While cloning I am providing the clone URL & target folder.

But every time I try to clone, I am getting this error:

Error: “fatal: unable to access ‘‘: Could not resolve host:”

What do I need to do to connect to GitHub ?

Enquirer: HyperioN


Solution #1:

I got a similar error, and it’s caused by incorrect proxy setting. This command saved me:

git config --global --unset http.proxy

https version:

git config --global --unset https.proxy
Respondent: Brian

Solution #2:

do i need to configure proxy settings? because my office has got proxy servers.

Yes, you can do so by setting HTTP_PROXY, and HTTPS_PROXY environment variables.

See “Syncing with github“:

set HTTPS_PROXY=http://<login_internet>:<password_internet>@aproxy:aport
set HTTP_PROXY=http://<login_internet>:<password_internet>@aproxy:aport
set NO_PROXY=localhost,

(To avoid putting your credentials — username/password — in clear in the proxy URL, see below)

Note the NO_PROXY, to allow to access internal site to your company

You also can register that in your git config:

git config --global http.proxy http://<login_internet>:<password_internet>@aproxy:aport

But if you have incorrect proxy Git settings, remove them:

cd /path/to/repo
git config --unset http.proxy
git config --global --unset http.proxy
git config --system --unset http.proxy

git config --unset https.proxy
git config --global --unset https.proxy
git config --system --unset https.proxy

# double-check with:
git config -l --show-origin | grep -i proxy

No credentials needed: use genotrance/px.
If you are, as I am, in a company behind a NTLM proxy, all you need to do is:

  • unzip anywhere you want
  • change the px.ini config file (put it in %USERPROFILE%), chaging the server line:
    server =  <= use your company proxy:port
    listen =
    port = 3128
  • use HTTP(S) proxy variable without your credentials! (the px proxy will reuse the ones from the current Widows session, either through Microsoft SSPI or Microsoft Kerberos)

That will give you:

set NO_PROXY=localhost,
Respondent: VonC

Solution #3:

Spent a couple hours trying to fix this.

Re-connecting my wifi did the trick.

Respondent: Chris Fremgen

Solution #4:

another possibility, I ran into this problem myself. But it was after I had installed a VPN (which was unrelated and running)

turning off the VPN, fixed the issue.

for the record, I was running “Viscosity” VPN on my MacBookPro

Respondent: Chadams

Solution #5:

I’ve had the same issue after running out of disk space. Closing and reopening terminal fixed it one time. Restarting my Mac the next.

Some easy things to try before jumping to random commands:

  • restart terminal tab
  • restart terminal app
  • If disk is full (or close to it) free up some disk space then restart terminal app
  • restart machine/OS
Respondent: scosman

Solution #6:

Would like to note, when I did Brian’s solution:

git config --global --unset http.proxy

make sure to quit and restart terminal. Mine didn’t resolve until I did that.

Thanks so much, issue was killing me!

Respondent: agrippa

Solution #7: is the current IP of which can be set in your local DNS (/etc/hosts in Linux and C:WindowsSystem32driversetchosts)

Respondent: Developer

Solution #8:

i have same issue and solve it by using this command

$git config –global http.proxy http://enter_your_proxy:enter_port

Respondent: Ankit Bhardwaj

Solution #9:

I had this very similar error as following.

C:wampwwwmyrepository [master]> git push
fatal: unable to access '': Couldn't resolve host ''

Actually, the prompt message has told us where’s wrong.

When I check my github, I found my github repository’s HTTPS url is

I don’t know how this happened. The wrong url has been set up by installed Git Shell automatically.

Once I remove the ‘/’ at the end, I can push successfully.

Respondent: John Yin

Solution #10:

It works for me

git config --global --unset http.proxy


git config --global --unset https.proxy
Respondent: Happy Patel

Solution #11:

In my case, on a Windows box, my TCP/IP stack seems to have needed to be reset. Resetting the TCP/IP stack of the client PC caused git to start behaving properly again. Run this command in Administrator mode at a command prompt and retry the git command:

netsh int ip reset

Manually disabling and re-enabling the network adapter via the Control Panel produces a similar result.

I suspect DNS resolution problems inside the TCP stack on my Windows box.

Respondent: johnwbyrd

Solution #12:

You can try these two commands,it helped me.

git config --global --unset http.proxy 
git config --global --unset https.proxy
Respondent: brean

Solution #13:

I want to let you all know that I was having this same issue. I solve it by resetting my remote URL git remote set-url origin I found how to do this from this answer but I had to change hit to https: Change the URI (URL) for a remote Git repository

Respondent: Lucy

Solution #14:

When you tried above solutions and nothing helps, you may need to checkout your local network settings and try to add and your local router ip to the DNS filed.

Respondent: Chris Yim

Solution #15:

Just in case future generations stuck in this too:
For me what worked (on mac OSX) was to set my DNS with opendns , I get this numbers here: For some reason, my dns configuration reseted to the default numbers (my local ip I guess), and I was not able to connect to neither github, brew or rubygems. Sorry for the misspelling.

Solution #16:

This solve the issue

git config --global --unset http.proxy

or https

git config --global --unset https.proxy
Respondent: James Rochabrun

Solution #17:

From the answer here -> my solution is specific for Windows Subsystem for Linux (WSL) users. None of the answers relating to proxies are relevant to my solution.

If you are unable to run a ping command e.g.


Then it is likely your file at /etc/resolve.conf is corrupt. To fix this run the following in a WSL window:

sudo rm /etc/resolve.conf

Then open a Powershell terminal in Administrator mode and run

# Powershell
wsl --shutdown
Get-Service LxssManager | Restart-Service

This should fix the problem, which can be tested by running the ping command again.

Respondent: d-man

Solution #18:

As a suggestion for Ubuntu servers, you can write down essid and password of router in your /etc/network/interfaces file:

iface [en0 || your wireless driver no necessarily en0] inet static
    address / (something for your static ip between 1-255)
    gateway / (this is the ip of your router)
    dns-nameservers / (you can use whatever you want)
    wpa-ssid qwertyuio / (this is router id)
    wpa-psk qwertyuio / (this is router password for wireless connection)

When I got this error while pulling a repository to my server, I wrote wpa-ssid and wpa-psk and restarted. Then it worked.

EDIT: I faced the same issue again and this time it was because of the inconsistency in router signal levels. My connection was not strong, that was the problem. However, the solution above is a real solution for static ip

Solution #19:

Edge case here but I tried (almost) all of the above answers above on VirtualBox and nothing was doing it but then closing not only the VirtualBoxVM but good ole VirtualBox itself and restarting the program itself did the trick without 0 complaint.

Hope that can help ~0.1% of queriers : )

Respondent: saylestyler

Solution #20:

One reason for this issue could be wrong/empty /etc/resolv.conf file.

The way I resolved this issue in my centos 7 minimal is as follows:
my /etc/resolv.conf was empty and I added the following lines:


where is my gateway, in your case it can be different.

Respondent: tig

Solution #21:

In my case I open a new terminal and problem solved. I don’t know exactly what caused the problem in the first place though.

Respondent: artronics

Solution #22:

Based on other solutions, what worked for me :

writing this in terminal :

git config --global --unset http.proxy
git config --global --unset https.proxy

restart – router
restart – mac

You can first try -2- , If that not working, then try -1- and -2-

Respondent: user1105951

Solution #23:

If you have a VPN needed to connect to your enterprise account and do a “git pull” this error will occur, just switch on your VPN and it will work.

Respondent: Zack

Solution #24:

Maybe it is because of your internet access, You can try:


If you get this error again, there was problem in your network configuration.

Respondent: yasi

Solution #25:

the simple solution to removing extra “/” from git clone remote is putting the url in parentheses. git clone ” “

Respondent: joel

Solution #26:

Different from all these solutions, in my case, I solved the issue when I restarted my terminal (or open another window).

Respondent: tong

Solution #27:

Restarting terminal in Mac worked.

Respondent: user3814933

Solution #28:

If all the above answers failed to solve your problem, try rebooting the router.

Worked for me.

Respondent: Lone Ronin

Solution #29:

Maybe it help someone somewhere, in my case (which was a private repo of git), host was suspended, so the issue was with my GitHub server and the administrator resolved it.

Respondent: Naser Nikzad

Solution #30:

It worked for me when I used “service apache2 stop”

Respondent: Ayush ShaZz

The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .

Most Popular

To Top
India and Pakistan’s steroid-soaked rhetoric over Kashmir will come back to haunt them both clenbuterol australia bossier man pleads guilty for leadership role in anabolic steriod distribution conspiracy