Git not working with a proxy server – gnutls_handshake() failed
This tutorial guides you on how to fix Git not working with proxy server issue i.e., access issue fatal: unable to access ‘https://github.com/nvm-sh/nvm.git/’: gnutls_handshake() failed: Error in the pull function when you try to install nvm as shown below.
Git not working with a proxy server – gnutls_handshake() failed
When I was trying to install nvm using the following command on Ubuntu Virtual Machine,
$ wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
The nvm installation is unsuccessful and resulted with the following error.
fatal: unable to access 'https://github.com/nvm-sh/nvm.git/': gnutls_handshake() failed: Error in the pull function
Then figured out that Git not working with proxy server and this Git access issue was due to proxy server settings on my Ubuntu VM. You need to follow the below steps in order to fix this kind of git access issues if you are also facing similar proxy server settings problem.
Fix for Git fatal: gnutls_handshake() failure
As a first step, you need to find out the proxy server host and port details for http and https as shown below.
To find http_proxy details, try running the following echo command.
$ echo $http_proxy http://xxx-country-city.corporate.domain.com:80
Similarly, for https_proxy
$ echo $https_proxy https://xxx-country-city.corporate.domain.com:80
Finally to enable git access or resolve git access issues related to proxy settings, you need to update the Git configuration settings using git config command. Therefore, you need to run the following two commands.
These commands will configure a proxy server for a specific domain in gitconfig if you’re having trouble cloning or fetching from a remote repository or getting an error like ‘unable to access ‘ or ‘Couldn’t resolve host‘ etc.,
$ git config --global http.proxy http://xxx-country-city.corporate.domain.com:80 $ git config --global https.proxy https://xxx-country-city.corporate.domain.com:80
Note, the above commands are for a specific domain. In case if you need to use username, password with proxy server and port then use the following format/ command.
git config --global http.proxy http://ProxyUsername:[email protected]:port
After configuring a global proxy, since all access to all repos require this proxy, now try running the nvm installation command. You should not see the fatal: unable to access again.
$ wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
nvm installation was successful. To verify the installation.
$ nvm -v 0.38.0
Hope it helped 🙂
- Set or change root password in Ubuntu Linux
- Connect to Github using SSH ?
- Linux: sudo: apt-get: command not found
- How to Start Stop Restart MariaDB on Linux OS ?
- Putty Fatal Error No supported authentication methods available
- How to find which users belongs to a specific group in linux
- Give write permissions for specific user or group for specific folder in linux
- How to unzip a zip file from Terminal (Google Cloud Shell)
- Build a Docker Image with a Dockerfile and Cloud Build in GCP?
- How to create GCP project on Google Cloud Platform
- MariaDB – How to set max_connections permanently ?
- How to create GCP project on Google Cloud Platform
- Is it possible to change Google Cloud Platform Project ID ?
- Create non-root SSH user account and provide access to specific folders
- MySQL : How to grant all privileges to the user on database ?
- How to install OpenJDK 11 in Ubuntu Machine ?
- Amazon Linux AMI : apt-get command not found
- How do you do undo git reset –hard HEAD^ and revert to previous commit ?