配置http.proxy适用于git但不适用于jgit

时间:2013-07-18 16:32:46

标签: git jgit

让我们首先显示--global .gitconfig,就像git和jgit看到它一样! 从DOS窗口以及Cgywin窗口

E:\> git config --list --global
http.auth.preference=Basic
user.name=Josef Stadelmann
user.email=josef.stadelmann@axa-winterthur.ch
http.proxy=http://C770817:MyPassword@bcproxyserver.ch.winterthur.com:8080

E:\>

现在让我们从带有JGit的Cygwin窗口看

$ jgit config --list --global
http.auth.preference=Basic
user.email=josef.stadelmann@axa-winterthur.ch
user.name=Josef Stadelmann
http.proxy=http://C770817:MyPassword@bcproxyserver.ch.winterthur.com:8080

我们可以看到相同的配置 然后 为什么

C770817@C036357 ~
$ jgit ls-remote https://github.com/stadelma/HelloWorld.git
fatal: Connection time out: github.com
fatal: https://github.com/stadelma/HelloWorld.git: cannot open git-upload-pack

超时但是

C770817@C036357 ~
$ git ls-remote http://github.com/stadelma/HelloWorld.git
35f375cb64208b64ed499c2a47727dfcd8813dea        HEAD
35f375cb64208b64ed499c2a47727dfcd8813dea        refs/heads/master

C770817@C036357 ~
$

处正确读取相同的.gitconfig
/cygdrive/e/mingw/home/.gitconfig

????

欢迎任何建议 - 或 - 我应该开始调试jgit吗?

约瑟夫

1 个答案:

答案 0 :(得分:2)

您可以尝试查看环境变量是否可以更好地工作,使用以下java选项:

-Dhttp.proxyHost=myproxyhosturl
-Dhttp.proxyPort=8080
-Dhttp.nonProxyHosts=”localhost|mybambooserverurl”

this question中一样:

  • Dhttp.proxyHost - 代理IP地址
  • Dhttp.proxyPort - 代理端口
  • Dhttp.proxyUser - 如果需要HTTP代理身份验证,则为用户名;
  • Dhttp.proxyPassword - 如果需要HTTP代理身份验证,则为用户密码。