本文基於
聲明
堅決擁護黨的領導,本文章所用技術乃出於工作需要,敬請諒解。
正文
可以先過去快速瀏覽一遍再回頭看本文章。上文有一處配置需要注意和容易迷惑的地方。在這里踩坑花了一下午。。。
即:要注意自己使用的Shadowsocks或其他代理(vTworay等)端口為是否為1080。如果不是,需要修改為相關端口。否則在進行命令行操作時,會提示連接到127.0.0.1:1080失敗 。
Failed to connect to 127.0.0.1 port 1080: Connection refused
查看Shadowsocks代理端口方法如下:
多次失敗截圖:
代理后看到的希望:
成功截圖:
補充
vTworay更好用
在發布sdk到cocoapods時,用Shadowsocks代理時會出現YYModel更新失敗,但是用vTworay就能夠成功!
socks5原理
https://baike.baidu.com/item/socks5
https://zhuanlan.zhihu.com/p/28645864
代理擴展用法
- If you do not want to set the proxy as global config, try ALL_PROXY= e.g.:
ALL_PROXY=socks5://127.0.0.1:xx git clone https://github.com/some/one.git
- (Just a little reminder) If you want the hostname also be resolved by the proxy (that means passing everything through the proxy), especially when you are cloning a gist, you can use the following setting (the key is that it uses socks5h instead of socks5):
git config --global http.proxy socks5h://127.0.0.1:xx
https://stackoverflow.com/questions/15227130/using-a-socks-proxy-with-git-for-the-http-transport#