Outbound Proxy on Bitbucket
Asked by Yves Tremp:

Hi all

I try to import a Git Repo on Bitbucket. I createt to Project and click on Import. I use then git with an url. In the Log it shows a connection error.

Bitbucket has no direct connection to the internet, I need to go through a proxy. The result with curl is okay.

The Bitbucket Properties has the following entries:

```
proxyName=server-proxy.xxxxx.ch
proxyPort=8080
scheme=https

server.proxy-port=443
server.proxy-name=mygit.xxxxx.ch

http.proxyHost=server-proxy.xxxxx.ch
http.proxyPort=8080
http.nonProxyHosts=localhost
https.proxyHost=server-proxy.xxxxx.ch
https.proxyPort=8080
https.nonProxyHosts=localhost
```

On "_start-webapp.sh" I configured the following

```

JVM_SUPPORT_RECOMMENDED_ARGS="-Dhttp.proxyHost=server-proxy.xxxxx.ch -Dhttp.proxyPort=8080 -Dhttp.nonProxyHosts=localhost -Dhttps.proxyHost=server-proxy.xxxxx.ch -Dhttps.proxyPort=8080 -Dhttps.nonProxyHosts=localhost"
```

```
?2021-06-07 14:07:19,314 ERROR [pool-6-thread-1] c.a.b.i.i.repository.RefSyncTask Failed to import repository: TEST/questdb[52]
com.atlassian.bitbucket.scm.CommandFailedException: '/usr/bin/git -c core.abbrev=40 -c credential.helper= -c gc.auto=0 fetch --force --prune --progress https://github.com/questdb/questdb.git +refs/*:refs/*' exited with code 128 saying: fat
al: unable to access 'https://github.com/questdb/questdb.git/': Failed to connect to github.com port 443: Connection timed out
at com.atlassian.bitbucket.scm.DefaultCommandExitHandler.onError(DefaultCommandExitHandler.java:47)
at com.atlassian.bitbucket.scm.git.command.GitCommandExitHandler.evaluateThrowable(GitCommandExitHandler.java:111)
at com.atlassian.bitbucket.scm.git.command.GitCommandExitHandler.onError(GitCommandExitHandler.java:208)
at com.atlassian.bitbucket.scm.DefaultCommandExitHandler.onExit(DefaultCommandExitHandler.java:32)
at com.atlassian.stash.internal.scm.git.command.fetch.FetchExitHandler.onExit(FetchExitHandler.java:39)
at com.atlassian.bitbucket.internal.process.nu.NioNuProcessHandler.callExitHandler(NioNuProcessHandler.java:286)
at com.atlassian.bitbucket.internal.process.nu.NioNuProcessHandler.finish(NioNuProcessHandler.java:327)
at com.atlassian.bitbucket.internal.process.nu.NioNuProcessHandler.onExit(NioNuProcessHandler.java:119)
at com.zaxxer.nuprocess.internal.BasePosixProcess.onExit(BasePosixProcess.java:307)
at com.zaxxer.nuprocess.linux.ProcessEpoll.handleExit(ProcessEpoll.java:371)
at com.zaxxer.nuprocess.linux.ProcessEpoll.cleanupProcess(ProcessEpoll.java:334)
at com.zaxxer.nuprocess.linux.ProcessEpoll.process(ProcessEpoll.java:272)
at com.zaxxer.nuprocess.internal.BaseEventProcessor.run(BaseEventProcessor.java:81)
at com.zaxxer.nuprocess.linux.ProcessEpoll.run(ProcessEpoll.java:188)
at com.zaxxer.nuprocess.linux.LinuxProcess.run(LinuxProcess.java:107)
at com.zaxxer.nuprocess.linux.LinProcessFactory.runProcess(LinProcessFactory.java:50)
at com.zaxxer.nuprocess.NuProcessBuilder.run(NuProcessBuilder.java:273)
at com.atlassian.bitbucket.internal.process.nu.NuNioProcessHelper.run(NuNioProcessHelper.java:75)
at com.atlassian.bitbucket.internal.process.NioCommand.call(NioCommand.java:52)
at com.atlassian.stash.internal.scm.git.command.SimpleGitCommand.configureAndCall(SimpleGitCommand.java:84)
at com.atlassian.stash.internal.scm.git.command.fetch.MirrorSynchronizeCommand.doFetch(MirrorSynchronizeCommand.java:126)
at com.atlassian.stash.internal.scm.git.command.fetch.MirrorSynchronizeCommand.call(MirrorSynchronizeCommand.java:97)
at com.atlassian.stash.internal.scm.git.command.fetch.MirrorSynchronizeCommand.call(MirrorSynchronizeCommand.java:35)
at com.atlassian.bitbucket.internal.importer.repository.RefSyncTask.syncRefs(RefSyncTask.java:122)
at com.atlassian.bitbucket.internal.importer.repository.RefSyncTask.importRepository(RefSyncTask.java:99)
at com.atlassian.stash.internal.user.DefaultEscalatedSecurityContext.call(DefaultEscalatedSecurityContext.java:59)
at com.atlassian.bitbucket.internal.importer.repository.RefSyncTask.call(RefSyncTask.java:62)
at com.atlassian.bitbucket.internal.importer.repository.RefSyncTask.call(RefSyncTask.java:35)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.lang.Thread.run(Thread.java:748)
... 1 frame trimmed
Caused by: com.atlassian.utils.process.ProcessException: Non-zero exit code: 128
at com.atlassian.bitbucket.internal.process.nu.NioNuProcessHandler.callExitHandler(NioNuProcessHandler.java:278)
... 26 common frames omitted
```


Answers:
author: Christian Glockner
body: Hi Yves,

These settings won't help because the git process runs outside the JVM, so any Java properties you specify won't apply to it.

This is something you'll need to configure in git on the server directly, something like this should help: <https://gist.github.com/evantoli/f8c23a37eb3558ab8765>

Cheers,

Christian

Premier Support Engineer

Atlassian

comments: author: Yves Tremp
body: Hi Christian

Thank you for the fast response.

Thats what I needed. I set the config for GIT and now it works.

Best Regards

Yves


Tags: bitbucket-server

server