Error messages

Git: “Could not resolve host: github.com” on Mac

Git could not get an address for github.com. For HTTPS remotes, Git prints curl's message. For SSH remotes, ssh prints its own message.

Applies to: Git that macOS or Homebrew installs, on all current macOS versions. The text was checked with Git 2.56 and OpenSSH 10.5.Checked: 29 October 2026

Symptoms

  • Git shows fatal: unable to access 'https://github.com/…/': Could not resolve host: github.com.
  • With an SSH remote, ssh shows Could not resolve hostname github.com: nodename nor servname provided, or not known.
  • git clone, git pull and git push all fail.

Likely causes

  • No connection or no DNS. The Mac cannot look up any name.
  • A proxy that Git does not use. On a network that needs a proxy, Git needs http.proxy or proxy variables.
  • A VPN or DNS filter. A VPN's DNS server or a filter can fail to answer for github.com.
  • A wrong remote URL. A typing error in the remote gives a name that does not exist.

How to check

  1. Show the remote URLs of the repository.

    git remote -v
  2. Look up github.com through the macOS resolver.

    dscacheutil -q host -a name github.com
  3. Show Git's proxy setting and your proxy variables.

    git config --get http.proxy
    env | grep -i proxy
  4. Test the HTTPS path with curl.

    curl -I https://github.com

How to fix it

  1. If the lookup fails for every name, fix DNS. See DNS not resolving on a Mac.

  2. If the network needs a proxy, set it for Git.

    git config --global http.proxy http://proxy.example.com:8080
  3. If an old proxy setting is wrong, remove it.

    git config --global --unset http.proxy
  4. Correct the remote URL if it has a typing error.

    git remote set-url origin https://github.com/OWNER/REPO.git

With Kilobat

  1. Kilobat's connection doctor tests the host layer by layer: network, proxy, DNS, rules, IPv4, IPv6, TLS and the server. It names the layer that failed.

    kilobat why github.com
  2. These Kilobat checks are free. AI agents run them through MCP with diagnose_connection and diagnose_network. See Find why one site or API won't connect.

Questions

Is GitHub down?

Maybe, but a lookup error is usually local. If dscacheutil finds other names but not github.com, look at your DNS or filter.

Sources

  • curl: libcurl error codes
  • git-config(1), http.proxy, man page installed with macOS 27.2 (Git 2.56)
  • ssh(1) and dscacheutil(1), man page installed with macOS 27.2

Sources checked on 29 October 2026. Man pages are the ones installed with macOS; open one with man <name> in Terminal.