Skip to content

Commit 754ae19

Browse files
MarkLodatogitster
authored andcommitted
http.c: add http.sslCertPasswordProtected option
Add a configuration option, http.sslCertPasswordProtected, and associated environment variable, GIT_SSL_CERT_PASSWORD_PROTECTED, to enable SSL client certificate password prompt from within git. If this option is false and if the environment variable does not exist, git falls back to OpenSSL's prompts (as in earlier versions of git). The environment variable may only be used to enable, not to disable git's password prompt. This behavior mimics GIT_NO_VERIFY; the mere existence of the variable is all that is checked. Signed-off-by: Mark Lodato <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 30dd916 commit 754ae19

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

Documentation/config.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,6 +1043,12 @@ http.sslKey::
10431043
over HTTPS. Can be overridden by the 'GIT_SSL_KEY' environment
10441044
variable.
10451045

1046+
http.sslCertPasswordProtected::
1047+
Enable git's password prompt for the SSL certificate. Otherwise
1048+
OpenSSL will prompt the user, possibly many times, if the
1049+
certificate or private key is encrypted. Can be overridden by the
1050+
'GIT_SSL_CERT_PASSWORD_PROTECTED' environment variable.
1051+
10461052
http.sslCAInfo::
10471053
File containing the certificates to verify the peer with when
10481054
fetching or pushing over HTTPS. Can be overridden by the

http.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,11 @@ static int http_options(const char *var, const char *value, void *cb)
140140
#endif
141141
if (!strcmp("http.sslcainfo", var))
142142
return git_config_string(&ssl_cainfo, var, value);
143+
if (!strcmp("http.sslcertpasswordprotected", var)) {
144+
if (git_config_bool(var, value))
145+
ssl_cert_password_required = 1;
146+
return 0;
147+
}
143148
#ifdef USE_CURL_MULTI
144149
if (!strcmp("http.maxrequests", var)) {
145150
max_requests = git_config_int(var, value);
@@ -360,7 +365,9 @@ void http_init(struct remote *remote)
360365

361366
if (remote && remote->url && remote->url[0]) {
362367
http_auth_init(remote->url[0]);
363-
if (!prefixcmp(remote->url[0], "https://"))
368+
if (!ssl_cert_password_required &&
369+
getenv("GIT_SSL_CERT_PASSWORD_PROTECTED") &&
370+
!prefixcmp(remote->url[0], "https://"))
364371
ssl_cert_password_required = 1;
365372
}
366373

0 commit comments

Comments
 (0)