Symptoms
-
When the build agent is started by an elevated Cygwin prompt, agent-side checkout fails with the error:
Failed to perform checkout on agent: git.exe -c credential.helper= -c credential.helper=C:/TeamCity/BuildAgent/temp/buildTmp/cred12345678901234567890.bat fetch --progress --recurse-submodules=no origin +refs/heads/develop:refs/heads/develop command failed. exit code: 128 stderr: fatal: detected dubious ownership in repository at '/cygdrive/c/TeamCity/BuildAgent/system/git/git-1234ABCD.git' To add an exception for this directory, call: git config --global --add safe.directory /cygdrive/c/TeamCity/BuildAgent/system/git/git-1234ABCD.git -
The
<agent_home>/system/git/git-1234ABCD.gitdirectory is owned by the Administrators group while the build agent is started by an elevated Cygwin prompt on behalf of a member of that group.
Cause
The <agent_home>/system/git/git-1234ABCD.git is owned by the Administrators group, while the Git process runs on behalf of the member of that group which have different SIDs. Cygwin Git compares SIDs and throws the dubious ownership error because they don't match. This is a Cygwin Git's issue.
Resolution
Use Git for Windows:
- Stop the build agent.
- Delete the
<agent_home>/system/git/git-1234ABCD.gitdirectory. - Install Git for Windows: https://gitforwindows.org/
- Ensure Git for Windows resolves via the
PATHenvironment variable for the build agent user. - Restart the build agent.
Comments
0 comments
Please sign in to leave a comment.