Git material authentication using cached username

107 views
Skip to first unread message

cal...@vertify.com

unread,
Feb 23, 2022, 11:51:48 AM2/23/22
to go-cd
Our GoCD 20.1.0 server is being affected by the bug "GitMaterial Authentication failed for the second user who using same repository" reported in the 2 issues listed here:

https://github.com/gocd/gocd/issues/8986
https://github.com/gocd/gocd/issues/9153

...in which the git clone at the agent uses a different username (previously configured username for that material/repo) than what is configured for the pipeline material.  When entering updated credentials on a pipeline material, the "Test Connection" button works on Material config, and the flyweight folder on the GoCD server for the pipeline uses the correct configured credentials. However when a build is triggered and the agent executes the git clone we see the wrong username and correct password being used.

I see an old message: https://groups.google.com/g/go-cd/c/SgqMvdSxMz4/m/kLqM3c4QBAAJ

"GoCD doesn't cache any credentials for git materials. What usually caches credentials is git's credential helper. "

However given that I can observe the git clone command being spawned with the wrong username (exactly as described in the bug reports), it leads me to believe the caching is in GoCD.

git.exe        5188        Process Create        C:\Program Files\Git\mingw64\libexec\git-core\git-remote-https.exe        SUCCESS        PID: 1860, Command line: git-remote-https origin https://someuser%test.com:[password-redacted]@bitbucket.org/myorg/somerepo.git

Has anyone found a workaround to get pipelines to stop using the old username part of the material credentials? I have tried everything I can think of (listed in my comment in the issue) - short of setting up a new GoCD server. I am assuming that upgrading the GoCD server won't help since the bug reports are still open.

Bitbucket is deprecating support for using account passwords on March 1, 2022 and we need to find a way to update credentials for all our pipelines.

Regards
Craig

GoCD version: 20.1.0 (11114-f2c1771e333ea92dae82cd78d2efa1310c1086f0)

Ashwanth Kumar

unread,
Feb 23, 2022, 12:03:34 PM2/23/22
to go...@googlegroups.com
As part of the list of things you're willing to try, please try this approach as well: try changing any character case in your scm connection url. 

Eg: Instead of bitbucket.org/myorg/somerepo.git try something like Bitbucket.org/myorg/somerepo.git (notice the capital B in the hostname).

This was an old workaround where-in scm materials are case sensitive in GoCD, I'm not sure if this has changed recently but worth a try IMHO.

Thanks,

--
You received this message because you are subscribed to the Google Groups "go-cd" group.
To unsubscribe from this group and stop receiving emails from it, send an email to go-cd+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/go-cd/5f78033f-99de-4c27-bbff-e9a3846bc801n%40googlegroups.com.


--

Ashwanth Kumar / ashwanthkumar.in

cal...@vertify.com

unread,
Feb 23, 2022, 12:19:37 PM2/23/22
to go-cd
Brilliant, it worked! Thanks so much Ashwanth. Now I will have my weekend back since I won't be setting up a new GoCD server before the March 1 deadline :)

Ashwanth Kumar

unread,
Feb 23, 2022, 12:21:59 PM2/23/22
to go...@googlegroups.com
Enjoy your weekend! 

Reply all
Reply to author
Forward
0 new messages