Sometimes 443 error or 60 error occurs when we try to clone repositories via https protocol.
➜ ~ git clone https://github.com/nvm-sh/nvm.git .nvm
Cloning into '.nvm'...
fatal: unable to access 'https://github.com/nvm-sh/nvm.git/': LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443
Reason
In most cases, an restricted network is the main reason.
Solutions
There are two ways to resolve the problem above.
Using ssh protocol (Easier)
Clone nvm source from GitHub via ssh protocol, i.e. change git clone http... to git clone ssh.... But first, you need to generate a new SSH key and adding it to the ssh-agent and add a new SSH key to your GitHub account.
Then it works.
➜ ~ git clone git@github.com:nvm-sh/nvm.git
Cloning into 'nvm'...
remote: Enumerating objects: 8539, done.
remote: Counting objects: 100% (337/337), done.
remote: Compressing objects: 100% (198/198), done.
remote: Total 8539 (delta 191), reused 260 (delta 130), pack-reused 8202
Receiving objects: 100% (8539/8539), 3.16 MiB | 1.79 MiB/s, done.
Resolving deltas: 100% (5377/5377), done.
Using proxy (More general)
There are two ways to set up proxy.
Using git config
To add a proxy in git globally, we need to set the git config:
➜ ~ git config --global http.proxy https://127.0.0.1:1080
➜ ~ git clone https://github.com/nvm-sh/nvm.git .nvm
Cloning into '.nvm'...
remote: Enumerating objects: 8539, done.
remote: Counting objects: 100% (337/337), done.
remote: Compressing objects: 100% (198/198), done.
remote: Total 8539 (delta 191), reused 260 (delta 130), pack-reused 8202
Receiving objects: 100% (8539/8539), 3.16 MiB | 208.00 KiB/s, done.
Resolving deltas: 100% (5377/5377), done.
In order to use the correct configuration variable, we can list all available configuration variables using git help --config
Using proxy environment variables
First, unset the key in .gitconfig file. Then add the http_proxy environment variable.
➜ ~ git config --global --unset http.proxy
➜ ~ git clone https://github.com/nvm-sh/nvm.git .nvm
Cloning into '.nvm'...
fatal: unable to access 'https://github.com/nvm-sh/nvm.git/': LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443
➜ ~ export http_proxy=http://127.0.0.1:1087
➜ ~ git clone https://github.com/nvm-sh/nvm.git .nvm
Cloning into '.nvm'...
remote: Enumerating objects: 8539, done.
remote: Counting objects: 100% (282/282), done.
remote: Compressing objects: 100% (174/174), done.
remote: Total 8539 (delta 154), reused 208 (delta 104), pack-reused 8257
Receiving objects: 100% (8539/8539), 3.17 MiB | 674.00 KiB/s, done.
Resolving deltas: 100% (5379/5379), done.