只使用代理服务器的某些git网址/域名? [英] Only use a proxy for certain git urls/domains?

查看:271
本文介绍了只使用代理服务器的某些git网址/域名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以将git配置为仅针对特定域使用代理?



我想使用我们的公司代理来访问Github,访问我们自己的内部git仓库。



我使用bower,它需要在我们的防火墙和github中都需要物品,所以我不能这样做项目设置。它需要是某种全局配置选项。任何想法?

解决方案

我通常使用环境变量:


  • http_proxy = http:// username:password @ proxydomain:port

  • https_proxy = http:// username:password @ proxydomain:port



访问GitHub仓库。



注意:


  • http_proxy https_proxy 必须使用 http:// 代理网址(无 https:// )。

  • 始终使用 fqn(全限定名称) proxydomain (不要依赖它的简称)



但是对于内部回购,我所要做的就是定义并导出一个环境变量:


  • no_proxy = .my.company,localhost,127.0.0.1,:: 1 ,用于访问任何回购机智h地址像 myrepo.my.company 或localhost。



您可以定义 NO_PROXY no_proxy ,这并不重要。

但为了防万一,我总是设置 HTTP_PROXY HTTPS_PROXY http_proxy https_proxy NO_PROXY no_proxy


Is it possible to configure git to use a proxy only for specific domains?

I'd like to use our corporate proxy to access Github but leave it off for accessing our own internal git repos.

I'm using bower and it needs to require items both within our firewall and on github so I can't do this as a per project setting. It needs to be some kind of global configuration option. Any thoughts?

解决方案

I usually use the environment variables:

  • http_proxy=http://username:password@proxydomain:port
  • https_proxy=http://username:password@proxydomain:port

That is picked up by git when accessing GitHub repo.

Note:

  • both http_proxy and https_proxy must use the http:// url of the proxy (no https://).
  • always use the fqn (full qualified name) of proxydomain (don't rely on its short name)

But for internal repo, all I have to do is define and export one more environment variable:

  • no_proxy=.my.company,localhost,127.0.0.1,::1, for accessing any repo with an address like myrepo.my.company or localhost.

You can define NO_PROXY or no_proxy, it doesn't matter.

But just in case, I always set HTTP_PROXY, HTTPS_PROXY, http_proxy, https_proxy, NO_PROXY and no_proxy.

这篇关于只使用代理服务器的某些git网址/域名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆