最初我可以以可接受的速度使用 ssh 执行 git clone。但是我的 ubuntu 崩溃了,所以我使用最新版本 13.04 重新安装。
重新安装所有内容后,我尝试再次使用 ssh 执行 git clone。但这次的平均速度大约是 3KB/s。
我用的是非ssh方式,速度不错。我也试过 ssh -vT login@host,速度还可以:
Transferred:发送3136,接收49936字节,20.5秒。
每秒字节数:发送 152.6,接收 2430.4
在此过程中,在这些调试消息之后有很长时间的等待:
debug1:身份文件/home/geow812/.ssh/id_rsa-cert type -1
debug1: SSH2_MSG_SERVICE_REQUEST 发送
debug1:发送 env LC_NAME = zh_CN.UTF-8
那么有人可以告诉我如何提高ssh速度吗?或者,如果您需要其他信息,请告诉我,因为我是 ssh 新手,不确定哪些信息与此问题相关。
小智 -1
#!/bin/bash
ping -c 3 google.com
echo
sudo ifconfig eth0 up
echo
ssh -vT login@host
echo
echo "AddressFamily inet" >> ~/.ssh/config
echo
ssh -vT git@example.com
echo
echo "Checking firewall settings..."
# List active iptables rules
sudo iptables -L -n
echo
echo "Checking proxy settings..."
# Check environment variables for proxy configuration
echo "HTTP Proxy: $http_proxy"
echo "HTTPS Proxy: $https_proxy"
echo "FTP Proxy: $ftp_proxy"
echo "No Proxy: $no_proxy"
echo
echo "Configuring SSH algorithm negotiation..."
echo "Host *"
echo " HostKeyAlgorithms=ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521"
echo " KexAlgorithms=diffie-hellman-group-exchange-sha256"
echo " Ciphers=aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes256-ctr"
echo
echo "Compression yes" >> ~/.ssh/config
echo
echo "Using HTTPS as an alternative..."
# Change the Git remote URL from SSH to HTTPS for the repository (replace URL)
# git remote set-url origin https://example.com/repo.git
echo
echo "Updating Git to the latest version..."
sudo apt-get update
sudo apt-get install git
echo
echo "SSH performance optimization completed."
Run Code Online (Sandbox Code Playgroud)