zoukankan      html  css  js  c++  java
  • git的代理配置

    来自: http://segmentfault.com/q/1010000000118837

    Git 目前支持的三种协议 http://git:// 和 ssh:// 其代理配置各不相同。http.proxy 用于 http://协议,core.gitproxy 用于 git:// 协议,ssh:// 协议的代理需要配置 ssh 的 ProxyCommand 参数。

    对于所有的协议全部使用 SSH 隧道进行代理

    HTTP 协议的配置

    [http]         #这里是因为 Git 使用 libcurl 提供 http 支持         proxy = socks5://127.0.0.1:7070 

    GIT 协议的配置

    建立 /path/to/socks5proxywrapper 文件,使用 https://bitbucket.org/gotoh/connect 工具进行代理的转换,各发行版一般打包为 proxy-connect 或者 connect-proxy。

    #!/bin/sh connect -S 127.0.0.1:7070 "$@" 

    配置 git

    [core]         gitproxy = /path/to/socks5proxywrapper 

    或者

    export GIT_PROXY_COMMAND="/path/to/socks5proxywrapper" 

    SSH 协议的配置

    建立 /path/to/soks5proxyssh 文件

    #!/bin/sh ssh -o ProxyCommand="/path/to/socks5proxywrapper %h %p" "$@" 

    配置 git 使用该 wrapper

    export GIT_SSH="/path/to/socks5proxyssh“ 

    当然也可以直接配置 ~/.ssh/config 的 ProxyCommand


    所有协议全部使用 http 代理

    HTTP 协议配置

    [http]     proxy = http://192.168.1.100:8080 

    /path/to/socks5proxywrapper 文件改为

    #!/bin/sh connect -H 192.168.1.100:8080 "$@" 

    针对域名启用代理

    gitproxy 参数提供 * for * 结构,具体看 man git-config 的 core.gitproxy 部分。

  • 相关阅读:
    [译]reset, checkout和revert
    [译]merge vs rebase
    [译]使用branch
    [译]git push
    [译]git pull
    [译]git fetch
    [译]git remote
    Java RTTI机制与反射机制
    Java反射的一些理解
    Java中的异常处理:何时抛出异常,何时捕获异常?
  • 原文地址:https://www.cnblogs.com/super119/p/3099379.html
Copyright © 2011-2022 走看看