溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

Github國內(nèi)訪問如何加速

發(fā)布時間:2021-11-15 17:16:41 來源:億速云 閱讀:271 作者:iii 欄目:大數(shù)據(jù)

這篇文章主要講解了“Github國內(nèi)訪問如何加速”,文中的講解內(nèi)容簡單清晰,易于學習與理解,下面請大家跟著小編的思路慢慢深入,一起來研究和學習“Github國內(nèi)訪問如何加速”吧!

配置 host

  1. 打開 http://tool.chinaz.com/dns,這是一個查詢域名映射關系的工具。

  2. 查詢 以下地址,得到其 ip:

    • github.global.ssl.fastly.net

    • assets-cdn.github.com

    • documentcloud.github.com

    • github.com

    • gist.github.com

    • help.github.com

    • nodeload.github.com

    • raw.github.com

    • status.github.com

    • training.github.com

    • www.github.com

    • avatars0.githubusercontent.com

    • avatars1.githubusercontent.com

    • codeload.github.com

  1. 多查幾次,選擇一個穩(wěn)定,延遲較低的 ip 按如下方式添加到 host 文件

自己的一次配置如下:

復制

1
2
3
151.101.73.194 github.global.ssl.fastly.net
151.101.72.133 assets-cdn.github.com
13.250.177.223 github.com

Git Proxy

github.com 上有兩種源碼獲取方式,一是 git clone,一是直接下載 master.zip,后者明顯速度快于前者,可以考慮:

  • 用 proxychains 這類透明代理,間接走系統(tǒng)中運行的代理工具中轉(zhuǎn);

  • 用 git 內(nèi)置代理,直接走系統(tǒng)中運行的代理工具中轉(zhuǎn),比如,你的 SS 本地端口是 1080,那么可以如下方式走代理

復制

1
2
git config --global http.proxy socks5://127.0.0.1:1080
git config --global https.proxy socks5://127.0.0.1:1080

假如你使用的是 http 協(xié)議走的代理,注意 http 對應的端口,假如為 1087:

復制

1
2
git config --global https.proxy http://127.0.0.1:1087
git config --global https.proxy http://127.0.0.1:1087

查看全局 config:

復制

1
cat ~/.gitconfig

顯示如下:

復制

1
2
3
4
5
[http]
	postBuffer = 524288000
	proxy = socks5://127.0.0.1:1086
[https]
	proxy = socks5://127.0.0.1:1086

最后,停用代理:

復制

1
2
git config --global --unset http.proxy
git config --global --unset https.proxy

感謝各位的閱讀,以上就是“Github國內(nèi)訪問如何加速”的內(nèi)容了,經(jīng)過本文的學習后,相信大家對Github國內(nèi)訪問如何加速這一問題有了更深刻的體會,具體使用情況還需要大家實踐驗證。這里是億速云,小編將為大家推送更多相關知識點的文章,歡迎關注!

向AI問一下細節(jié)

免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權內(nèi)容。

AI