TeamCity Build Agent Fails to connect to Bitbucket

I am upgrading to TeamCity 2018.2 build 60925 from 2017.1.2 build 46812

I have successfully installed and updated a new instance of TeamCity on a new server with the new agent on the same server as the Teamcity server (same as existing install).

I am having issues the TeamCity Agent refusing to connect to bitbucket, while teamcity itself can connect to bitbucket.


Team City can connect to bitbucket


Agent on same server cannot

Failed to build patch for build #20 {build id=20774, buildTypeId=DevelopmentPipelineInfrustructure_ConfigurationVerification}, VCS root: "Pipeline - Bitbucket " {instance id=8, parent internal id=2, parent id=PipelineBitbucket, description: ""}, due to error: 'git fetch' command failed (repository dir: /system/caches/git/git-B43162DF.git).

stderr: cannot open git-upload-pack

stdout: [2019-01-03 10:26:32,707]   INFO - Triggers.vcs.git.GitServerUtil - Failed to list remote refs, continue without pruning removed refs

org.eclipse.jgit.errors.TransportException: cannot open git-upload-pack

            at org.eclipse.jgit.transport.TransportHttp.connect(

            at org.eclipse.jgit.transport.TransportHttp.openFetch(

            at jetbrains.buildServer.buildTriggers.vcs.git.GitServerUtil.pruneRemovedBranches(

            at jetbrains.buildServer.buildTriggers.vcs.git.GitServerUtil.pruneRemovedBranches(

            at jetbrains.buildServer.buildTriggers.vcs.git.Fetcher.pruneRemovedBranches(

            at jetbrains.buildServer.buildTriggers.vcs.git.Fetcher.fetch(

            at jetbrains.buildServer.buildTriggers.vcs.git.Fetcher.main(

Caused by: Connection refused: connect

            at org.eclipse.jgit.util.HttpSupport.response(

            at org.eclipse.jgit.transport.TransportHttp.connect(

            ... 6 more

exit code: 1


1 comment

I thought i had found that the solution:

i had to hard code the git (Git\bin\git.exe) path into the svc path, it would not read the windows env.TEAMCITY_GIT_PATH


but this seems to solve the issue sometimes, the error seems to be back again


Please sign in to leave a comment.