allow GIT_ASKPASS as a pass through env var #2564
Conversation
pre_commit/git.py
Outdated
| 'GIT_SSL_NO_VERIFY', 'GIT_CONFIG_COUNT', | ||
| 'GIT_HTTP_PROXY_AUTHMETHOD', | ||
| 'GIT_ALLOW_PROTOCOL', | ||
| 'SSH_ASKPASS', 'GIT_ASKPASS', 'GIT_USERNAME', 'GIT_PASSWORD', |
There was a problem hiding this comment.
SSH_ASKPASSdoesn't start withGIT_so it's not relevantGIT_USERNAMEisn't a variable supported bygitGIT_PASSWORDisn't a variable supported bygit
There was a problem hiding this comment.
oops, good point; removed ssh_askpass. although git_username/git_password isn't directly, it is the default used by jenkins git plugin; so there is no way to provide creds down to git from jenkins as a caller without it. is there any harm in adding it ? I don't think you can use jenkins credential store to execute precommit otherwise.
There was a problem hiding this comment.
jenkins shouldn't be setting environment variables in other tools' namespaces -- I'm fine adding GIT_ASKPASS but not the other ones
There was a problem hiding this comment.
fair enough; removed in latest force push. commit is just GIT_ASKPASS now
documented via man gitcredentials, it is used to provide a script/input for git to fetch creds in a no-tty usecase. used among other things by jenkins to pass credentials down to git for authentication. https://github.com/jenkinsci/git-plugin/blob/1e3488a730a169778ba0863dd4edbb1dc29154a1/README.adoc#git-bindings https://github.com/jenkinsci/git-plugin/blob/9429e7d05df3dbb4060ac6ab4da6538bb0eb50ba/src/main/java/jenkins/plugins/git/GitUsernamePasswordBinding.java#L130
|
in case anyone ever stumbles onto this from google, i was mistaken on GIT_USERNAME/GIT_PASSWORD, those aren't actually passed down by that plugin as env vars at all; just me failing to read java code properly. thanks for the merge 👍 |

documented via man gitcredentials, it is used to provide a script/input for git to fetch creds in a no-tty usecase. used among other things by jenkins to pass credentials down to git for authentication.
https://github.com/jenkinsci/git-plugin/blob/1e3488a730a169778ba0863dd4edbb1dc29154a1/README.adoc#git-bindings https://github.com/jenkinsci/git-plugin/blob/9429e7d05df3dbb4060ac6ab4da6538bb0eb50ba/src/main/java/jenkins/plugins/git/GitUsernamePasswordBinding.java#L130