Setting up TeamCity with my own GIT Server over SS

2019-03-29 08:05发布

问题:

I have my own GIT server repository and can be connected via HTTPS protocol.

I am trying to setup TeamCity to connect to my GIT repo but I am unable to because of the HTTPS protocol.

In Eclipse, I have a setting that sets sslVerify=false and I can connect to my GIT repo and perform my task.

How can i achieve the same for TeamCity?

回答1:

As issue TW-30210 illustrates, it can depends on the version of TeamCity and Java you are using.

It also depends if your certificate is self-signed or not.
If is is signed (and validate by an actual CA - Certificate Authority), then you need to add it in your java keystore (used by TeamCity): see "Using HTTPS to access TeamCity server".

If you just want to disable ssl verification, you can do on the TeamCity server:

  • for git commands, and
  • for the java you are using to run the TeamCity server.

    -Dcom.sun.net.ssl.checkRevocation=false
    

But that is considered as a bad practice.



回答2:

Addition for answer above with samples for default setup:

openssl s_client -connect <githost>:443 </dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > /opt/exported.cert
keytool -import -noprompt -trustcacerts -alias <githost> -file /opt/exported.cert -keystore ${JAVA_HOME}/jre/lib/security/cacerts -storepass changeit

Where,

githost - domain name of host with git repo



回答3:

We were using 32-bit version of git on teamcity server (64-bit). So removing 32-bit and installing 64-bit git bash and git cmd helped resolve the GIT and Teamcity connection problem for us. I hope this help some users.