1. Configure Git to use a proxy
  2. ##In Brief
  3.  
  4. 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 '...'.
  5.  
  6. Consider something like:
  7.  
  8. git config --global http.proxy http://proxyUsername:proxyPassword@proxy.server.com:port
  9. Or for a specific domain, something like:
  10.  
  11. git config --global http.https://domain.com.proxy http://proxyUsername:proxyPassword@proxy.server.com:port
  12. git config --global http.https://domain.com.sslVerify false
  13. 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.
  14.  
  15. See also the git-config documentation, especially the following sections if you're having HTTPS/SSL issues
  16.  
  17. http.sslVerify
  18. http.sslCAInfo
  19. http.sslCAPath
  20. http.sslCert
  21. http.sslKey
  22. http.sslCertPasswordProtected
  23. In Detail
  24. Configure the proxy
  25. You can configure these globally in your user ~/.gitconfig file using the --global switch, or local to a repository in its .git/config file.
  26.  
  27. Setting a global proxy
  28. Configure a global proxy if all access to all repos require this proxy
  29.  
  30. git config --global http.proxy http://proxyUsername:proxyPassword@proxy.server.com:port
  31. URL specific proxy
  32. 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:
  33.  
  34. git config --global http.https://domain.com.proxy http://proxyUsername:proxyPassword@proxy.server.com:port
  35. Which will result in the following in the ~/.gitconfig file:
  36.  
  37. [http]
  38. [http "https://domain.com"]
  39. proxy = http://proxyUsername:proxyPassword@proxy.server.com:port
  40. Handle subsequent SSL protocol errors
  41. 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
  42.  
  43. git -c http.sslVerify=false clone https://domain.com/path/to/git
  44. Once cloned, you may decide set this for just this cloned repository's .git/config by doing. Notice the absence of the --global
  45.  
  46. git config http.sslVerify false
  47. If you choose to make it global then limit it to a URL using the http.<url>.sslVerify notation:
  48.  
  49. git config --global http.https://domain.com.sslVerify false
  50. Which will result in the following in the ~/.gitconfig file:
  51.  
  52. [http]
  53. [http "https://domain.com"]
  54. proxy = http://proxyUsername:proxyPassword@proxy.server.com:port
  55. sslVerify = false
  56. Show current configuration
  57. To show the current configuration of all http sections
  58.  
  59. git config --global --get-regexp http.*
  60. If you are in a locally cloned repository folder then you drop the --global and see all current config:
  61.  
  62. git config --get-regexp http.*
  63. Unset a proxy or SSL verification
  64. 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:
  65.  
  66. git config --global --unset http.proxy
  67. git config --global --unset http.https://domain.com.proxy
  68.  
  69. git config --global --unset http.sslVerify
  70. 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. hook C++

    Intercepting Calls to COM Interfaces(hook com接口) 通过COM组件IFileOperation越权复制文件 代码注入之远程线程篇 使用VC++通过远程进程 ...

  2. douyu danmu test c#

    using System; using System.Net; using System.Net.Sockets; using System.Text; using System.Text.Regul ...

  3. C# WPF 漂亮的loading 效果

    <UserControl x:Class="TestLoadPic.Loading" xmlns="http://schemas.microsoft.com/win ...

  4. leetcode 113 path Sum II 路径和

    递归先序遍历+vector<int>容器记录路径 /** * Definition for a binary tree node. * struct TreeNode { * int va ...

  5. 2、electron进程

    electron核心我们可以分成2个部分,主进程和渲染进程. 主进程: 主进程连接着操作系统和渲染进程,可以把她看做页面和计算机沟通的桥梁. Electron 运行 package.json 的 ma ...

  6. mysql 批量删表

    Select CONCAT( 'drop table ', table_name, ';' ) FROM information_schema.tables Where table_name LIKE ...

  7. linux上执行mysql的脚本文件

    我们测试过程中,经常需要执行升级脚本或导入生产测试数据,对于轻量的升级脚本可以直接在客户端工具中打开执行,但是对于文件内容比较大的.sql文件,比如几百M,几G的sql文件,直接拖到客户端工具打开执行 ...

  8. CentOS下搭建docker+.net core

    运行环境: CentOS 7.0 容器:Docker 1.13.1 .Net Core版本: .NET Core 2.1,安装详见 CentOS 7 下安装.NET Core SDK 2.1 1.安装 ...

  9. faker数据填充详解

    安装 在laravel中已经自动集成,无需手动安装.如需在其他地方使用,可使用以下命令进行安装. composer require fzaninotto/faker 为Faker指定中文支持 可通过在 ...

  10. 通过编写串口助手工具学习MFC过程——(二)通过“打开串口”按钮了解基本操作

    通过编写串口助手工具学习MFC过程 因为以前也做过几次MFC的编程,每次都是项目完成时,MFC基本操作清楚了,但是过好长时间不再接触MFC的项目,再次做MFC的项目时,又要从头开始熟悉.这次通过做一个 ...