由于開發(fā)的過程中较锡,經(jīng)常遇到pod update比較慢的情況业稼,所以記錄下實(shí)用的方法,備忘下念链。這個(gè)是在CSND上看到的盼忌,但原文章沒有提供端口的獲取方式积糯。
此方法主要通過修改git的代理配置掂墓,主要是端口號(hào),從而解決git連接github遠(yuǎn)程比較慢的問題看成。
1.獲取代理工具的端口號(hào)君编。
例如shandowsocks的:
4539EF2B-49C2-4ED8-8EBF-246E1C3FF889.png
2.依次輸入兩個(gè)命令:
/* !!!!//127.0.0.1:1086 和//127.0.0.1:1086。并不是注釋川慌,而是命令的一部分 */
git config --global http.proxy socks5://127.0.0.1:1086
git config --global http.https://github.com.proxy socks5://127.0.0.1:1086
執(zhí)行后可重新pod update 嘗試吃嘿。如果沒有改善,那么可以回滾梦重,使用其他優(yōu)化方式(如果是shandowsocks,有可能需要開啟手動(dòng)模式的代理)兑燥。
回滾操作:
git config --global --unset http.proxy
git config --global --unset http.https://github.com.proxy
python更新腳本
import os
import sys
import subprocess
#param -on -off
class GitConfig:
def __init__(self):
pass
def setGitConfig():
cmd = 'git config --global http.proxy socks5://127.0.0.1:1086'
cmd1 = 'git config --global http.https://github.com.proxy socks5://127.0.0.1:1086'
subprocess.call(cmd,shell = True)
subprocess.call(cmd1,shell = True)
print('set github confif proxy')
subprocess.call('git config --global --list',shell = True)
pass
def resetGitConfig():
cmd = 'git config --global --unset http.proxy'
cmd1 = 'git config --global --unset http.https://github.com.proxy'
subprocess.call(cmd,shell = True)
subprocess.call(cmd1,shell = True)
print('reset github confif proxy')
subprocess.call('git config --global --list',shell = True)
pass
if __name__ == "__main__" :
params = sys.argv
if len(params) > 1 :
sw = params[1]
if sw.lower() == '-on' or sw.lower() == '-off' :
gitConfig = GitConfig
if sw.lower() == '-on' :
gitConfig.setGitConfig()
else:
gitConfig.resetGitConfig()
link:
pod install速度慢的終極解決方案