linux使用git时传输速度太低,提速
作者:互联网
下面是我自己写的脚本:
#!/bin/bash # author TommyWang # website http://dynmi.top fast_ip=`nslookup github.global.ssl.fastly.Net|egrep '[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}'` fast_ip=${fast_ip##*:} git_ip=`nslookup github.com|egrep '[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}'` git_ip=${git_ip##*:} echo "${fast_ip}" echo "${git_ip}" sed -i '/github.global.ssl.fastly.Net/d' /etc/hosts sed -i '/github.com/d' /etc/hosts echo "github.global.ssl.fastly.Net${fast_ip} github.com${git_ip}" >> /etc/hosts sudo systemctl restart nscd
将它加入到crontab 定时执行中,必须是root身份,在/etc/crontab中追加(修改脚本地址)
10 10 * * * root /home/dynmi/Documents/essential_bash/refresh_git_ip.sh
标签:digit,git,ip,fast,传输速度,etc,github,linux 来源: https://www.cnblogs.com/dynmi/p/13042799.html