We use JGit for testing our hooks. It seems since Bitbucket 5.14.0 our tests intermittently fail when we perform clone or push operations. The error we sometimes get is:
org.eclipse.jgit.api.errors.TransportException: http://localhost:8080/bitbucket/scm/test/test.git: expected Content-Type application/x-git-receive-pack-result; received Content-Type application/x-git-receive-pack-advertisement at org.eclipse.jgit.api.PushCommand.call(PushCommand.java:164) at org.eclipse.jgit.api.PushCommand.call(PushCommand.java:80) at com.onresolve.bitbucket.groovy.test.BaseRepoTest.gitPush(BaseRepoTest.groovy:372) at com.onresolve.bitbucket.groovy.test.TestConditionFunctions.secure shell successes of #condition(TestConditionFunctions.groovy:538) Caused by: org.eclipse.jgit.errors.TransportException: http://localhost:8080/bitbucket/scm/test/test.git: expected Content-Type application/x-git-receive-pack-result; received Content-Type application/x-git-receive-pack-advertisement at org.eclipse.jgit.transport.TransportHttp.wrongContentType(TransportHttp.java:588) at org.eclipse.jgit.transport.TransportHttp$Service.openResponse(TransportHttp.java:882) (19 more lines...)
We’ve tried using the same version of JGit Bitbucket Server 5.14 uses for it’s testing, also we’ve upgraded to the most recent version of JGit but no luck.
We’re also using git version 2.7.4 which doesn’t support the new V2 protocol, but I wouldn’t have thought this would be an issue. We’d like to better understand this error and why it happens in 5.14+ and hopefully try to solve it.