配置的http.proxy适用于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吗?

Josef

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

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

正如在这个问题中:

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

最新更新