Failed to perform checkout on agent: Unable to run git at path C:\Program Files (x86)\Git\bin

Hi,    We are trying to have teamcity check out the full repository locally on agent so we can adjust some files and locations of files and do a commit back to the repository.

When we try to check out on the local agent when defining the Git repository, we get the following error.    Git.exe does exist in the folder specified.

We have the git path specified in teamcity with the same location as shown in screen shots below.

C:\Program Files (x86)\Git\bin

[15:31:02]Updating sources: agent side checkout

[15:31:02][Updating sources] Failed to perform checkout on agent: Unable to run git at path C:\Program Files (x86)\Git\bin





Capture.PNG


Capture.PNG
7 comments
Comment actions Permalink

Hi,

Are you able to checkout repository via console under the same user as TeamCity agent runs?

0
Comment actions Permalink


Hi Alina,

No I was not able to do a git clone or git pull using the account teamcity uses.  Our teamcity build agent is running with the local system account.

Do we need to change the account the teamcity build agent runs under?

Do we need to generate a ssh key and go with that approach?

Thanks
Lance

0
Comment actions Permalink

Hi Lance,

In case of agent side checkout TeamCity agent runs git commands the same way as you run it via console. So you need to configure git to work outside TeamCity and then use the same setting for TeamCity agent.

0
Comment actions Permalink

I just set up the TC build agent to run using my AD account and I get the same error.

I am able to do a git clone with my AD account on that machine with no problems.

0
Comment actions Permalink

Which git version do you use?
Could you please try to run agent using agent.bat script from the same console where git commands run successfully?
Also please attach teamcity-vcs.log and teamcity-agent.log files.

0
Comment actions Permalink

Hi,

So we have tried to tackle this from a different point of view using SSH keys, etc.    We created the ssh key and ultimately put this key on the github repository.

On the local box where we are trying to do the agent side checkout, I am able to run the following command successfully.

git clone git@github.com:Organization/RepoName.git c:\gitrepo

and it will ask for the passphrase of the ssh key in c:\users\MyUserName\.ssh\id_rsa      and then create the clone successfully.


I am running this logged in as myself which is the same account that the buildagent runs under.   (if I try to run this using the system account it does not work)

So I configured the agent side checkout with the following configurations shown in the screen shot below.

I know get the error.

Test connection failed in Data Services Data Fix :: DEV ReportingOnward Data Fix. Repository 'git@github.com:Organization/RepoName.git': Unable to load identity file: C:\users\MyUserName\.ssh\id_rsa (passphrase protected)

Am I do this wrong?



Capture.PNG

0
Comment actions Permalink

Hi Lance,

Sorry for delay. Which TeamCity version do you use? Private key is supported for agent-side checkout only since 8.1, see https://youtrack.jetbrains.com/issue/TW-18449.
If you use newer version, then private key must be in OpenSSH format (you can do it using Conversions in PuttyGen).

0

Please sign in to leave a comment.