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: "https://bitbucket.org/myaccount/blah"}, due to error: 'git fetch' command failed (repository dir: /system/caches/git/git-B43162DF.git).
stderr: https://bitbucket.org/myaccount/blah 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: https://bitbucket.org/myaccount/blah: cannot open git-upload-pack
at org.eclipse.jgit.transport.TransportHttp.connect(TransportHttp.java:530)
at org.eclipse.jgit.transport.TransportHttp.openFetch(TransportHttp.java:315)
at jetbrains.buildServer.buildTriggers.vcs.git.GitServerUtil.pruneRemovedBranches(GitServerUtil.java:351)
at jetbrains.buildServer.buildTriggers.vcs.git.GitServerUtil.pruneRemovedBranches(GitServerUtil.java:335)
at jetbrains.buildServer.buildTriggers.vcs.git.Fetcher.pruneRemovedBranches(Fetcher.java:130)
at jetbrains.buildServer.buildTriggers.vcs.git.Fetcher.fetch(Fetcher.java:109)
at jetbrains.buildServer.buildTriggers.vcs.git.Fetcher.main(Fetcher.java:64)
Caused by: java.net.ConnectException: Connection refused: connect bitbucket.org
at org.eclipse.jgit.util.HttpSupport.response(HttpSupport.java:175)
at org.eclipse.jgit.transport.TransportHttp.connect(TransportHttp.java:481)
... 6 more
exit code: 1
Please sign in to leave a 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