git,curl,wget重定向到localhost

时间:2016-10-17 19:27:58

标签: python sockets

Git给了我这个错误:

$ git clone How people build software · GitHub
Cloning into 'xxxx'... fatal: unable to access 'xxx (Michael Dungan) · GitHub': Failed to connect to 127.0.0.1 port 443: Connection refused

curl也会出错:

$ curl http://baidu.com
curl: (7) Failed to connect to 127.0.0.1 port 80: Connection refused

wget也会出错:

$ wget http://baidu.com
Error parsing proxy URL “ http://127.0.0.1:8123 ”: Scheme missing.

但是ping没问题:

ping http://baidu.com
PING http://baidu.com (180.149.132.47): 56 data bytes
64 bytes from 180.149.132.47: icmp_seq=0 ttl=52 time=24.689 ms
64 bytes from 180.149.132.47: icmp_seq=1 ttl=52 time=23.770 ms
64 bytes from 180.149.132.47: icmp_seq=2 ttl=52 time=25.112 ms

我的浏览器还可以。

我重启了我的Mac,关闭了我的代理,VPN,但它永远不会改变。写这个python代码后会出现此问题:

socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, "127.0.0.1", 9050)
socket.socket = socks.socksocket
socket.create_connection = create_connection
socket.getaddrinfo = getaddrinfo

1 个答案:

答案 0 :(得分:1)

我已经解决了这个问题,我错过了/.bash_profile中的http_proxy,https_proxy系统环境变量。删除它们,现在没关系。