Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git clone failed to begin relaying via HTTP

Tags:

linux

github

ssh

When Using git clone, I come into an error. Here is the command and the error information.

[user@linux]$ git clone [email protected]:username/repertory.git
FATAL: failed to begin relaying via HTTP.
ssh_exchange_identification: Connection closed by remote host
fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists.

Except for git@github, git clone https://...... and git clone git://...... works well. So i guess there is something wrong with ssh protocal, then i checked ssh.

[user@linux]$ ssh -T [email protected]
Hi username! You've successfully authenticated, but GitHub does not provide shell access.

It seems that I can connect to github through ssh protocol properly. But what's wrong with git clone through ssh?

like image 970
yduan Avatar asked Sep 16 '26 14:09

yduan


1 Answers

This error message comes from connect.c from SSH

It is a SSH Proxy Command -- connect.c, the simple relaying command to make network connection via SOCKS and https proxy: You can make SSH session beyond the firewall with this command.

So check if such a connection is needed: it could very well be needed if you are in an enterprise, behind firewall, but in that case do contact your IT support team to check the validity/approval of such a solution.

And that error message indicates that even this SSH mode (relay through https proxy) might be blocked.

If you are not in an enterprise setting, and don't need proxy, do remove them (HTTPS(S)/PROXY) from your environment variables and your git config file.

like image 115
VonC Avatar answered Sep 18 '26 03:09

VonC



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!