Configure Git to use a proxy
##In Brief You may need to configure a proxy server if you're having trouble cloning or fetching from a remote repository or getting an error like unable to access '...' Couldn't resolve host '...'. Consider something like: git config --global http.proxy http://proxyUsername:proxyPassword@proxy.server.com:port
Or for a specific domain, something like: git config --global http.https://domain.com.proxy http://proxyUsername:proxyPassword@proxy.server.com:port
git config --global http.https://domain.com.sslVerify false
Setting http.<url>.sslVerify to false may help you quickly get going if your workplace employs man-in-the-middle HTTPS proxying. Longer term, you could get the root CA that they are applying to the certificate chain and specify it with either http.sslCAInfo or http.sslCAPath. See also the git-config documentation, especially the following sections if you're having HTTPS/SSL issues http.sslVerify
http.sslCAInfo
http.sslCAPath
http.sslCert
http.sslKey
http.sslCertPasswordProtected
In Detail
Configure the proxy
You can configure these globally in your user ~/.gitconfig file using the --global switch, or local to a repository in its .git/config file. Setting a global proxy
Configure a global proxy if all access to all repos require this proxy git config --global http.proxy http://proxyUsername:proxyPassword@proxy.server.com:port
URL specific proxy
If you wish to specify that a proxy should be used for just some URLs that specify the URL as a git config subsection using http.<url>.key notation: git config --global http.https://domain.com.proxy http://proxyUsername:proxyPassword@proxy.server.com:port
Which will result in the following in the ~/.gitconfig file: [http]
[http "https://domain.com"]
proxy = http://proxyUsername:proxyPassword@proxy.server.com:port
Handle subsequent SSL protocol errors
If you're still having trouble cloning or fetching and are now getting an unable to access 'https://...': Unknown SSL protocol error in connection to ...:443 then you may decide to switch off SSL verification for the single operation by using the -c http.sslVerify=false option git -c http.sslVerify=false clone https://domain.com/path/to/git
Once cloned, you may decide set this for just this cloned repository's .git/config by doing. Notice the absence of the --global git config http.sslVerify false
If you choose to make it global then limit it to a URL using the http.<url>.sslVerify notation: git config --global http.https://domain.com.sslVerify false
Which will result in the following in the ~/.gitconfig file: [http]
[http "https://domain.com"]
proxy = http://proxyUsername:proxyPassword@proxy.server.com:port
sslVerify = false
Show current configuration
To show the current configuration of all http sections git config --global --get-regexp http.*
If you are in a locally cloned repository folder then you drop the --global and see all current config: git config --get-regexp http.*
Unset a proxy or SSL verification
Use the --unset flag to remove configuration being specific about the property -- for example whether it was http.proxy or http.<url>.proxy. Consider using any of the following: git config --global --unset http.proxy
git config --global --unset http.https://domain.com.proxy git config --global --unset http.sslVerify
git config --global --unset http.https://domain.com.sslVerify

 

https://gist.github.com/evantoli/f8c23a37eb3558ab8765

git-shell设置代理的更多相关文章

  1. github for window 中 git shell 设置代理方法和解决ssl证书错误的问题

    体验了一下传说中的 github for windows(操作git有很多的方法,我还没有学会,所以找了个简单的方法),听说用起来还不错,毕竟也开始接触了github.下载地址是 http://win ...

  2. Git Bash设置代理

    从GitHub clone代码速度比较慢,设置代理,(假设端口是1080): git config --global https.proxy http://127.0.0.1:1080 git con ...

  3. git中设置代理

    说明:在某种原因下,整个网络都是使用代理的情况下,需要使用git clone,这时就需要设置代理了. 在没有设置代理的时候,直接克隆报错  Failed to connect to gitee.com ...

  4. Git中设置代理和取消代理

    设置Socks5代理 git config --global http.proxy 'socks5://127.0.0.1:1080' && git config --global h ...

  5. git中设置代理,本地不使用代理,针对域名设置代理

    想要的效果是: [1]本地IP不使用代理 [2]外网的仓库(如GitHub)使用代理 [3]适用于全局 方案 打开路径: C --> 用户 --> [我的账号] --> .gitco ...

  6. (转)在公司的局域网使用git或github 设置代理

    目录 [hide] 1 生成SSH Key 2 git使用http访问 3 git使用ssh进行访问 在公司这样的局域网环境中,向要走网络必须走HTTP代理出去.不能直接访问外面的服务,所以这样安全了 ...

  7. CMD 和 Git 中的代理设置

    CMD 设置代理 在 cmd 环境下设置代理可能不是很常用,但是某些情况下还是可能会用到,比如公司的电脑只能通过设置代理访问外网,而你需要在 cmd 环境下使用 gem 命令更新文件时. 当然,如果你 ...

  8. git 设置代理.

    git 设置代理:(因为网络有时太慢,需要用到 ss 代理..) git config --global http.proxy http://127.0.0.1:1080 取消 代理 git conf ...

  9. git设置代理模式,仅为github设置代理

    设置代理: 全局代理 git config --global http.proxy 127.0.0.1:1087 局部代理,在github clone 仓库内执行 git config --local ...

  10. 如何设置单个 Git 仓库的代理从而提高更新速度

    如何设置单个 Git 仓库的代理从而提高更新速度 因为特殊原因,需要单独对 Git 仓库设置远程代理,从而提高更新速度. 主要原因是因为有一些远程 Git 仓库比较慢. 最初的想法是系统全局代理,但是 ...

随机推荐

  1. 【linux】cp 批量复制文件

    [需求]: 有2个文件夹a,b,现在需要将a文件夹下的所有文件(aa.py,a2.py,a3.py)都复制到b文件夹(空文件夹) [解决办法]: 首先想到的是使用正则表达式,但是发现在linux中,只 ...

  2. Windows下GIT的用户密码修改

    Windows下GIT的用户密码修改

  3. Oracle 无备份情况下的恢复--控制文件/数据文件

    13.3无备份恢复控制文件 没有备份恢复控制文件其实就是在nomount状态,create control创建一个新的控制文件. dba必须知道4个信息才能正确的创建:数据库名.在线日志路径及其大小. ...

  4. 如何通过shell脚本或一行命令更改root密码?

    哪个能用就用哪个吧! 方法一, echo -e "newpwd\nnewpwd" | (passwd root) 方法二, echo "newpwd" | pa ...

  5. python string_2 内建函数详解

    先定义2个字符串变量 #coding:utf-8 s1="http" s2="http://www.cnblogs.com/sub2020/p/7988111.html& ...

  6. python locust 进行压力测试

    最近公司项目周期比较赶, 项目是软硬结合,在缺少硬件的情况下,通过接口模拟设备上下架和购买情况,并进行压力测试, 本次主要使用三个接口 分别是3个场景: 生成商品IP, 对商品进行上架, 消费者购买商 ...

  7. Web高效管理多个项目的SVN仓库

    转至:https://www.jianshu.com/p/a0af00642585 采用方案 Linux+Apache+Subversion+MySQL+JDK+Tomcat+Svnadmin 目录 ...

  8. Win密钥.Win7旗舰版

    1.windows7旗舰版免费密钥 - Win7之家.html(http://www.windows7en.com/Win7/25762.html) HT6VR-XMPDJ-2VBFV-R9PFY-3 ...

  9. 题解 AT1877 【回文分割】

    题意:给定一个字符串 s,将 s 分割成一些子串,使每个子串都是回文串. 返回 s 所有可能的分割方案. 示例: 输入:aab 输出:3 解释:aba 思路: 记录字符串中每个字符出现的次数si 如果 ...

  10. 题解 CF1140D 【Minimum Triangulation】

    题意:求将一个n边形分解成(n-2)个三边形花费的最小精力,其中花费的精力是所有三角形的三顶点编号乘积的和(其中编号是按照顶点的顺时针顺序编写的) 考虑1,x,y连了一个三角形,x,y,z连了一个三角 ...