Configure git to use IPv4 instead of IPv6 by default

nobeh picture nobeh · Feb 10, 2014 · Viewed 16.8k times · Source

Checking the environment variables and also HTTP configuration options does not reveal something. Is there a way to do this?

Answer

Anthony C Howe picture Anthony C Howe · Jan 31, 2016

The more generic solution (that also works for BSD) is to edit the global /etc/ssh/ssh_config or per-user ~/.ssh/config and add/replace the entry:

AddressFamily any 

with

AddressFamily inet

You can also set this for just a single host:

Host example.com
    AddressFamily inet