由于開發的過程中,經常遇到pod update比較慢的情況,所以記錄下實用的方法,備忘下。這個是在CSND上看到的,但原文章沒有提供端口的獲取方式。
此方法主要通過修改git的代理配置,主要是端口號,從而解決git連接github遠程比較慢的問題。
1.獲取代理工具的端口號。
例如shandowsocks的:
4539EF2B-49C2-4ED8-8EBF-246E1C3FF889.png
2.依次輸入兩個命令:
/* !!!!//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
執行后可重新pod update 嘗試。如果沒有改善,那么可以回滾,使用其他優化方式(如果是shandowsocks,有可能需要開啟手動模式的代理)。
回滾操作:
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速度慢的終極解決方案