Git login fail using powershell script
Completed
Hello!
In one of my build steps I use a powershell script that updates git submodules. I have two TeamCity Agents on a single machine. On Agent 1 the script runs fine, however on Agent 2 it fails with the following error: "Logon failed, use ctrl+c to cancel basic credential prompt." From my investigation I cannot find any differences between the Agents. The password for git is saved in Windows Credential manager.
Any help is greatly appreciated!
Please sign in to leave a comment.
Hello,
Could you please let me know if the agents in question share the same identity (i.e. if they are running as service, are they started under the same user? if they are started via command line, are the processes started on the same user session?).
Hello,
sorry for the late reply. Yes both agent are started under the same user.
Let`s try to isolate possible issue causes:
1) for some reason, stored password is not available for the 2nd agent. Has this agent been ever restarted since the credentials were stored in Credentials Manager? If that is the case, perchance agent restart will help it to access the new credential set.
2) is there an override on repository-level config file for the credential.helper entry? Resulting configuration should look like this in order to use credentials manager as helper: [credential] helper = manager
3) can you try to run submodule update under the same user as agents are running as, with a working directory set at checkout folder of 2nd agent? (you may find the checkout folder in build log by "Checkout directory: " prefix)
I've run the script again on the agent it wasn't working, to get the correct folder where the repository is. And it works now. Perhaps it really just needed a restart or someone else changed something. Thanks for your assistance. If it ever stops working, I will use your pointers to debug.
That`s great to hear, thank you for the notice!