macos 配置 iTerm 和 Git 以在 OS X 上使用代理
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5137852/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Configuring iTerm and Git to use a proxy on OS X
提问by kinet
I am successfully connecting to the internet using an application called tether for a jailbroken iphone. (I know there's better options now).
我使用名为 tether 的应用程序成功连接到互联网,用于越狱的 iphone。(我知道现在有更好的选择)。
My iphone is connected to my laptop's wifi "device network".
我的 iPhone 已连接到笔记本电脑的 wifi“设备网络”。
I have in my OS X network settings a location called iphone and the proxy is configured to use the correct IP and port for the phone.
我的 OS X 网络设置中有一个名为 iphone 的位置,并且代理配置为使用电话的正确 IP 和端口。
I can browse the internet using Chrome over http and https perfectly.
我可以完美地通过 http 和 https 使用 Chrome 浏览互联网。
iTerm cannot ping google. Git cannot pull. I've googled for days and don't see anything "easy" or that I understand. Any advice is appreciated.
iTerm 无法 ping 谷歌。Git 不能拉。我已经用谷歌搜索了好几天,没有看到任何“简单”或我理解的东西。任何建议表示赞赏。
回答by Mostafa
Command-line tools usually only support HTTP proxy. For providing a HTTP proxy out of a SOCKS one you have Privoxy. After you've set up Privoxy you have an HTTP proxy. In terminal usually saying export http_proxy=ip:port
is enough for most applications. For Git specifically consult here.
命令行工具通常只支持 HTTP 代理。为了从 SOCKS 中提供 HTTP 代理,您拥有 Privoxy。设置 Privoxy 后,您就有了一个 HTTP 代理。在终端通常说export http_proxy=ip:port
对于大多数应用程序就足够了。对于 Git,请在此处具体咨询。
But if that's too much for you, you can use sshuttle. It transparently transfers allyour connections through a SOCKS proxy. That is, all the connections in your computer, and after that you don't have to change proxy settings for your GUI apps.
但如果这对你来说太多了,你可以使用sshuttle。它通过 SOCKS 代理透明地传输您的所有连接。也就是说,您计算机中的所有连接,之后您不必更改 GUI 应用程序的代理设置。
I use Homebrewas my package manager in Mac, and both Privoxy and sshuttle are available in it.
我在 Mac 中使用Homebrew作为我的包管理器,Privoxy 和 sshuttle 都可以在其中使用。