u123
u123

Reputation: 16329

Cannot run git fetch from Team City command line build step

I have a simple command line build step in a Team City (9.0.2 build 32195) build configuration that just calls:

git fetch

but when I run the build configuration it just hangs. Running:

git log

works fine. Any ideas why git fetch hangs while git log works?

EDIT: The hanging issues seems to be caused by TC waiting for credentials when running git fetch. So the solution would be to somehow store the credentials for git for the user running the job.

enter image description here

Upvotes: 2

Views: 2711

Answers (1)

VonC
VonC

Reputation: 1329492

You can see if a git credential helper would alliviate the issue here: it would cache the password and allow for any git command requiring authentication to get the password that way.

See "Managing Remotes / Caching your GitHub password in Git Caching your GitHub password in Git" (since TeamCity server uses jgit, not git directly)

Noye that it is possible, as noted in this thread, that TeamCity does not support yet credential helpers.

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.

Upvotes: 2

Related Questions