If a checkout step or any other git cli call fails it shows the password in the error message:
13:44:26,754 INFO - Getting changes of 'git-repo' since build '1.119.1'...
13:44:48,270 ERROR - fatal: Authentication failed for '
https://user:
mysecretpassword@giturl.git/'
13:44:48,357 ERROR - error: Could not fetch origin
13:44:48,598 INFO - Executing post-execute action...
13:44:48,598 ERROR - Step 'master>checkout>git' is failed: Failed to run command: git fetch --all -q
Command return code: 1
Command error output: fatal: Authentication failed for '
https://user:
mysecretpassword@giturl.git/'
error: Could not fetch origin
13:44:48,775 INFO - Executing post-execute action...
13:44:48,775 ERROR - Step 'master>checkout' is failed: Composite step 'checkout' failed due to unsatisfied success condition.
I just replaced the real information in the output, but that's something that shows up in the build log etc and should not be known by simple users.
vars.getValue("password")
And then define a variable named "password" with prompt type set to "secret"