python scripts that uses git and need to be provided with core.askPass
Hello
I wrote a python script that do a bunch of git command and needs to provide them with git user and password I saw that teamcity is using core.askPass to run remote git command and it provide it with some bat file with a hashname.
I dont know how teamcity decid about this name of file but Im wondering if I can use that same bat file for running my script?
I wanted to know if there is a way for me to know what core.askPass file is being created by teamcity and provide it as an input to my script to run git?
The script will run on the Agent by teamcity.
Thanks,
Tamar
Please sign in to leave a comment.
Hi Tamar,
unfortunately you won't be able to reuse the script, as it gets deleted as soon as it's used (for security reasons). If you need your login data, what you could do is, instead of setting the values directly in the VCS Root configuration, define the user/pass as build parameters, then reuse them in the VCS configuration. More on using build parameters here: https://confluence.jetbrains.com/display/TCD10/Configuring+Build+Parameters
Hope this makes sense.
Just to help others along, here is how to create and use a custom credential helper that will provide Git with the password supplied as a build parameter when prompted:
This script can be supplied to Git as a path to a file (must make it executable), but you can also set the value of `credential.helper` to an inline script, meaning the value is the string above. You can configure the credential helper in the Git settings using git config credential.helper <value> or supplying it as an overridden config like this:
git -c credential.helper='!f() { echo "password=%env.access_token%"; }; f' fetch origin develop