{"slug": "configure-git-to-use-a-proxy", "title": "Configure Git to use a proxy", "summary": "This article explains how to configure Git to use a proxy server, which is necessary when encountering errors while cloning or fetching from remote repositories. It provides commands for setting a global proxy, a domain-specific proxy, and for disabling SSL verification as a temporary workaround for workplace HTTPS proxying issues. The guide also covers how to view, set, and unset these configurations either globally or for a specific repository.", "body_md": "# Configure Git to use a proxy\n\n## In Brief\n\nYou may need to configure a proxy server if you're having trouble cloning \nor fetching from a remote repository or getting an error \nlike `unable to access '...' Couldn't resolve host '...'`.\n\nConsider something like:\n\n```\ngit config --global http.proxy http://proxyUsername:proxyPassword@proxy.server.com:port\n```\n\nOr for a specific domain, something like:\n\n```\ngit config --global http.https://domain.com.proxy http://proxyUsername:proxyPassword@proxy.server.com:port\ngit config --global http.https://domain.com.sslVerify false\n```\n\nSetting `http.<url>.sslVerify` to `false` may help you quickly get going if your workplace \nemploys man-in-the-middle HTTPS proxying. Longer term, you could get the \nroot CA that they are applying to the certificate chain\nand specify it with either `http.sslCAInfo` or `http.sslCAPath`.\n\nSee also the [git-config](https://git-scm.com/docs/git-config) documentation, especially the following \nsections if you're having HTTPS/SSL issues\n \n * `http.sslVerify`\n * `http.sslCAInfo`\n * `http.sslCAPath`\n * `http.sslCert`\n * `http.sslKey`\n * `http.sslCertPasswordProtected`\n\n## In Detail\n\n### Configure the proxy \n\nYou can configure these globally in your user `~/.gitconfig` file using the `--global` switch, or local to a repository in its `.git/config` file.\n\n#### Setting a global proxy\n\nConfigure a global proxy if all access to all repos require this proxy\n\n```\ngit config --global http.proxy http://proxyUsername:proxyPassword@proxy.server.com:port\n```\n\n#### URL specific proxy\n\nIf you wish to specify that a proxy should be used for just \nsome URLs that specify the URL as a git config subsection\nusing `http.<url>.key` notation:\n\n```\ngit config --global http.https://domain.com.proxy http://proxyUsername:proxyPassword@proxy.server.com:port\n```\n\nWhich will result in the following in the `~/.gitconfig` file:\n\n```\n[http]\n[http \"https://domain.com\"]\n\tproxy = http://proxyUsername:proxyPassword@proxy.server.com:port\n```\n\n#### Handle subsequent SSL protocol errors\n\nIf you're still having trouble cloning or fetching and are now getting \nan `unable to access 'https://...': Unknown SSL protocol error in connection to ...:443` then\nyou may decide to switch off SSL verification for the single operation \nby using the `-c http.sslVerify=false` option\n\n```\ngit -c http.sslVerify=false clone https://domain.com/path/to/git\n```\n\nOnce cloned, you may decide set this for just this cloned \nrepository's `.git/config` by doing. Notice the absence of the `--global`\n\n```\ngit config http.sslVerify false\n```\n\nIf you choose to make it global then limit it to a URL using \nthe `http.<url>.sslVerify` notation: \n\n```\ngit config --global http.https://domain.com.sslVerify false\n```\n\nWhich will result in the following in the `~/.gitconfig` file:\n\n```\n[http]\n[http \"https://domain.com\"]\n\tproxy = http://proxyUsername:proxyPassword@proxy.server.com:port\n\tsslVerify = false\n```\n\n### Show current configuration\n\nTo show the current configuration of all `http` sections\n\n```\ngit config --global --get-regexp http.*\n```\n\nIf you are in a locally cloned repository folder then you drop \nthe `--global` and see all current config:\n\n```\ngit config --get-regexp http.*\n```\n\n### Unset a proxy or SSL verification\n\nUse the `--unset` flag to remove configuration being specific about the\nproperty -- for example whether it was `http.proxy` or `http.<url>.proxy`. \nConsider using any of the following:\n\n```\ngit config --global --unset http.proxy\ngit config --global --unset http.https://domain.com.proxy\n\ngit config --global --unset http.sslVerify\ngit config --global --unset http.https://domain.com.sslVerify\n\n```\n", "url": "https://wpnews.pro/news/configure-git-to-use-a-proxy", "canonical_source": "https://gist.github.com/evantoli/f8c23a37eb3558ab8765", "published_at": "2016-01-12 01:02:18+00:00", "updated_at": "2026-05-22 17:37:40.669902+00:00", "lang": "en", "topics": ["developer-tools"], "entities": ["Git"], "alternates": {"html": "https://wpnews.pro/news/configure-git-to-use-a-proxy", "markdown": "https://wpnews.pro/news/configure-git-to-use-a-proxy.md", "text": "https://wpnews.pro/news/configure-git-to-use-a-proxy.txt", "jsonld": "https://wpnews.pro/news/configure-git-to-use-a-proxy.jsonld"}}