假设你有ss的1080的sockt5代理
git config --global http.proxy 'socks5://127.0.0.1:1080'
git config --global https.proxy 'socks5://127.0.0.1:1080'
还有一个问题,就是使用socialauth进行github登录的时候, 服务器怎么办呢?
socialauth的HttpUtil提供了设置代理的方法,但是,兼顾github和qq登陆的情况下, 全部走代理不是最优解.
所以,强行修改其源码
URL url = new URL(urlStr);
if (urlStr.startsWith("https://github")) {
try {
Socket socket = new Socket();
socket.connect(ssLocal, 1000);
socket.close();
log.debug("using ss-local");
conn = (HttpURLConnection) url.openConnection(new Proxy(Type.SOCKS, ssLocal));
} catch (Exception e) {
log.debug("ss-local not running?");
}
}
if (conn == null) {
if (proxyObj != null) {
conn = (HttpURLConnection) url.openConnection(proxyObj);
} else {
conn = (HttpURLConnection) url.openConnection();
}
}