Merge branch 'kf/askpass-config'
* kf/askpass-config: Extend documentation of core.askpass and GIT_ASKPASS. Allow core.askpass to override SSH_ASKPASS. Add a new option 'core.askpass'.
This commit is contained in:
@ -450,6 +450,15 @@ core.excludesfile::
|
|||||||
to the value of `$HOME` and "{tilde}user/" to the specified user's
|
to the value of `$HOME` and "{tilde}user/" to the specified user's
|
||||||
home directory. See linkgit:gitignore[5].
|
home directory. See linkgit:gitignore[5].
|
||||||
|
|
||||||
|
core.askpass::
|
||||||
|
Some commands (e.g. svn and http interfaces) that interactively
|
||||||
|
ask for a password can be told to use an external program given
|
||||||
|
via the value of this variable. Can be overridden by the 'GIT_ASKPASS'
|
||||||
|
environment variable. If not set, fall back to the value of the
|
||||||
|
'SSH_ASKPASS' environment variable or, failing that, a simple password
|
||||||
|
prompt. The external program shall be given a suitable prompt as
|
||||||
|
command line argument and write the password on its STDOUT.
|
||||||
|
|
||||||
core.editor::
|
core.editor::
|
||||||
Commands such as `commit` and `tag` that lets you edit
|
Commands such as `commit` and `tag` that lets you edit
|
||||||
messages by launching an editor uses the value of this
|
messages by launching an editor uses the value of this
|
||||||
|
@ -639,6 +639,13 @@ Usually it is easier to configure any desired options through your
|
|||||||
personal `.ssh/config` file. Please consult your ssh documentation
|
personal `.ssh/config` file. Please consult your ssh documentation
|
||||||
for further details.
|
for further details.
|
||||||
|
|
||||||
|
'GIT_ASKPASS'::
|
||||||
|
If this environment variable is set, then git commands which need to
|
||||||
|
acquire passwords or passphrases (e.g. for HTTP or IMAP authentication)
|
||||||
|
will call this program with a suitable prompt as command line argument
|
||||||
|
and read the password from its STDOUT. See also the 'core.askpass'
|
||||||
|
option in linkgit:git-config[1].
|
||||||
|
|
||||||
'GIT_FLUSH'::
|
'GIT_FLUSH'::
|
||||||
If this environment variable is set to "1", then commands such
|
If this environment variable is set to "1", then commands such
|
||||||
as 'git blame' (in incremental mode), 'git rev-list', 'git log',
|
as 'git blame' (in incremental mode), 'git rev-list', 'git log',
|
||||||
|
1
cache.h
1
cache.h
@ -1035,6 +1035,7 @@ extern int pager_in_use(void);
|
|||||||
extern int pager_use_color;
|
extern int pager_use_color;
|
||||||
|
|
||||||
extern const char *editor_program;
|
extern const char *editor_program;
|
||||||
|
extern const char *askpass_program;
|
||||||
extern const char *excludes_file;
|
extern const char *excludes_file;
|
||||||
|
|
||||||
/* base85 */
|
/* base85 */
|
||||||
|
3
config.c
3
config.c
@ -605,6 +605,9 @@ static int git_default_core_config(const char *var, const char *value)
|
|||||||
if (!strcmp(var, "core.editor"))
|
if (!strcmp(var, "core.editor"))
|
||||||
return git_config_string(&editor_program, var, value);
|
return git_config_string(&editor_program, var, value);
|
||||||
|
|
||||||
|
if (!strcmp(var, "core.askpass"))
|
||||||
|
return git_config_string(&askpass_program, var, value);
|
||||||
|
|
||||||
if (!strcmp(var, "core.excludesfile"))
|
if (!strcmp(var, "core.excludesfile"))
|
||||||
return git_config_pathname(&excludes_file, var, value);
|
return git_config_pathname(&excludes_file, var, value);
|
||||||
|
|
||||||
|
@ -621,13 +621,16 @@ int finish_connect(struct child_process *conn)
|
|||||||
|
|
||||||
char *git_getpass(const char *prompt)
|
char *git_getpass(const char *prompt)
|
||||||
{
|
{
|
||||||
char *askpass;
|
const char *askpass;
|
||||||
struct child_process pass;
|
struct child_process pass;
|
||||||
const char *args[3];
|
const char *args[3];
|
||||||
static struct strbuf buffer = STRBUF_INIT;
|
static struct strbuf buffer = STRBUF_INIT;
|
||||||
|
|
||||||
askpass = getenv("GIT_ASKPASS");
|
askpass = getenv("GIT_ASKPASS");
|
||||||
|
if (!askpass)
|
||||||
|
askpass = askpass_program;
|
||||||
|
if (!askpass)
|
||||||
|
askpass = getenv("SSH_ASKPASS");
|
||||||
if (!askpass || !(*askpass))
|
if (!askpass || !(*askpass))
|
||||||
return getpass(prompt);
|
return getpass(prompt);
|
||||||
|
|
||||||
|
@ -37,6 +37,7 @@ size_t delta_base_cache_limit = 16 * 1024 * 1024;
|
|||||||
const char *pager_program;
|
const char *pager_program;
|
||||||
int pager_use_color = 1;
|
int pager_use_color = 1;
|
||||||
const char *editor_program;
|
const char *editor_program;
|
||||||
|
const char *askpass_program;
|
||||||
const char *excludes_file;
|
const char *excludes_file;
|
||||||
enum auto_crlf auto_crlf = AUTO_CRLF_FALSE;
|
enum auto_crlf auto_crlf = AUTO_CRLF_FALSE;
|
||||||
int read_replace_refs = 1;
|
int read_replace_refs = 1;
|
||||||
|
3
git.c
3
git.c
@ -56,9 +56,6 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)
|
|||||||
{
|
{
|
||||||
int handled = 0;
|
int handled = 0;
|
||||||
|
|
||||||
if (!getenv("GIT_ASKPASS") && getenv("SSH_ASKPASS"))
|
|
||||||
setenv("GIT_ASKPASS", getenv("SSH_ASKPASS"), 1);
|
|
||||||
|
|
||||||
while (*argc > 0) {
|
while (*argc > 0) {
|
||||||
const char *cmd = (*argv)[0];
|
const char *cmd = (*argv)[0];
|
||||||
if (cmd[0] != '-')
|
if (cmd[0] != '-')
|
||||||
|
Reference in New Issue
Block a user