How to use Git credential helper to access private repository

We're currently using TeamCity with Perforce, server is running on Windows.  We are going to be moving to a GitHub Enterprise server soon, and I am trying to get TeamCity to access a test server prior to the move.

The code is going to be in private repositories, so all access must be authenticated.  We are going to be using access tokens and don't want those tokens stored in the TeamCity project settings.

I already have the git credential helper enabled on the build server, and the access token for the server is stored there.  I can clone that repository from the command line using no authentication in the URL, which is our desired method.

However, when I try to create a VCS Root using the https URL of a private repository, I get an authentication failure error when trying to test the connection.  If I switch to the URL of a public repository under the same username, I am able to successfully test the connection.

I have tried setting the internal property for the git executable to point at the git.exe in the GitHub for Windows install to make sure it's not using a different version of git that we have installed that doesn't support https URLs.

I have not been able to find any information about anyone using git credential helpers with TeamCity.  Has anyone done this before?

Thanks,
Greg

6 comments
Comment actions Permalink

TeamCity doesn't support git credential helpers at this time. As a workaround you can clone repository via SSH and use default private key authentication method for example. In this case TeamCity will know nothing about your SSH key. Or you can upload an SSH key into TeamCity and use it. In this case it is stored under TeamCity data dir, but not in the settings.

0
Comment actions Permalink

Do you know why credential helpers are not supported?  I thought that they were handled transparently by the installed version of git.

0
Comment actions Permalink

Because TeamCity server uses jgit - a java git implementation, not the native git.


0
Comment actions Permalink

Oh, I saw this in the TeamCity Git documentation and thought that it no longer did that:

https://confluence.jetbrains.com/display/TCD9/Git
"Git needs to be installed on the server machine and, if the agent-side checkout is used, on the agents."

0
Comment actions Permalink

Further down that page, it gives the list of paths where it tries to find git.exe on Windows and git on other platforms.  It doesn't mention jgit at all.
Is jgit used for the server connections and installed git for the agent connections?
Except that even further down is the internal setting "teamcity.server.git.executable.path" which is described as the native git executable on the server.

0
Comment actions Permalink

It seems like documentation is wrong, we will fix that, thank you. Yes jgit is used on the server and native git is used on the agent.

0

Please sign in to leave a comment.