让你的终端使用代理下载GIT(polipo)

/ 0评 / 0

主要就是安装 polipo 工具。

brew install polipo

然后就是启动polipo程序开机自动启动。

首先要修改自动启动的配置文件 /usr/local/opt/polipo/homebrew.mxcl.polipo.plist,需要给polipo命令加上命令行参数 socksParentProxy=localhost:1080

  <span class="cp"><?xml version="1.0" encoding="UTF-8"?></span>
  <span class="cp"><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"></span>
  <span class="nt"><plist</span> <span class="na">version=</span><span class="s">"1.0"</span><span class="nt">></span>
    <span class="nt"><dict></span>
      <span class="nt"><key></span>Label<span class="nt"></key></span>
      <span class="nt"><string></span>homebrew.mxcl.polipo<span class="nt"></string></span>
      <span class="nt"><key></span>RunAtLoad<span class="nt"></key></span>
      <span class="nt"><true/></span>
      <span class="nt"><key></span>KeepAlive<span class="nt"></key></span>
      <span class="nt"><true/></span>
      <span class="nt"><key></span>ProgramArguments<span class="nt"></key></span>
      <span class="nt"><array></span>
        <span class="nt"><string></span>/usr/local/opt/polipo/bin/polipo<span class="nt"></string></span>
        <span class="nt"><string></span>socksParentProxy=localhost:1080<span class="nt"></string></span>
      <span class="nt"></array></span>
    <span class="nt"></dict></span>
  <span class="nt"></plist></span>

然后执行以下命令,搞定收工。

ln -sfv /usr/local/opt/polipo/*.plist ~/Library/LaunchAgents
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.polipo.plist

polipo进程默认监听8123端口,在命令行使用export http_proxy=http://localhost:8123 就可以使用代理了。

export https_proxy=http://localhost:8123

export ftp_proxy=http://localhost:8123

发表评论

邮箱地址不会被公开。 必填项已用*标注