git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v3] add 'git credential' plumbing command

From
Kkonglu@minatec.inpg.fr <konglu@minatec.inpg.fr>
Date
Jun 11, 2012, 19:07 UTC
Message-ID
<20120611210745.Horde.72y3YnwdC4BP1kIBup3BWrA@webmail.minatec.grenoble-inp.fr>
In-Reply-To
<1339440294-8010-1-git-send-email-Javier.Roucher-Iglesias@ensimag.imag.fr>
Javier.Roucher-Iglesias@ensimag.imag.fr a écrit :
Show 22 quoted lines
> +Git-credential permits to the user of the script to save:
> +username, password, host, path and protocol. When the user of script
> +invoke git-credential, the script can ask for a password, using the command
> +'git credential fill'.
> +Taking data from the standard input, the program treats each line as a
> +separate data item, and the end of series of data item is signalled by a
> +blank line.
> +
> +		username=admin\n
> +		protocol=[http|https]\n
> +		host=localhost\n
> +		path=/dir\n\n
> +
> +-If git-credential system has the password already stored
> +git-credential will answer with by STDOUT:
> +
> +		username=admin
> +		password=*****
> +
> +-If it is not stored, the user will be prompt for a password:
> +
> +		> Password for '[http|https]admin@localhost':
Whitespaces detected (and also some more after in the doc)
Show 43 quoted lines
> diff --git a/builtin/credential.c b/builtin/credential.c
> new file mode 100644
> index 0000000..a6b6962
> --- /dev/null
> +++ b/builtin/credential.c
> @@ -0,0 +1,37 @@
> +#include <stdio.h>
> +#include "cache.h"
> +#include "credential.h"
> +#include "string-list.h"
> +
> +static const char usage_msg[] =
> +"credential <fill|approve|reject>";
> +
> +void cmd_credential (int argc, char **argv, const char *prefix) {
> +	const char *op;
> +	struct credential c = CREDENTIAL_INIT;
> +	int i;
> +
> +	op = argv[1];
> +	if (!op)
> +		usage(usage_msg);
> +
> +	if (credential_read(&c, stdin) < 0)
> +		die("unable to read credential from stdin");
> +
> +	if (!strcmp(op, "fill")) {
> +		credential_fill(&c);
> +		if (c.username)
> +			printf("username=%s\n", c.username);
> +		if (c.password)
> +			printf("password=%s\n", c.password);
> +	}
> +	else if (!strcmp(op, "approve")) {
> +		credential_approve(&c);
> +	}
> +	else if (!strcmp(op, "reject")) {
> +		credential_reject(&c);
> +	}
> +	else {
> +		usage(usage_msg);
> +	}
> +}
Structure:
	if (!strcmp(op, "fill")) {
		credential_fill(&c);
		if (c.username)
			printf("username=%s\n", c.username);
		if (c.password)
			printf("password=%s\n", c.password);
	} else if (!strcmp(op, "approve")) {
		credential_approve(&c);
	} else if (!strcmp(op, "reject")) {
		credential_reject(&c);
	} else {
		usage(usage_msg);
	}
Previous: roucherjNext: roucherj
Message 4 of 5 in “add 'git credential' plumbing command”
  1. add 'git credential' plumbing commandjavier.roucher-iglesias@ensimag.imag.fr, Jun 11, 2012
  2. Matthieu MoyJun 11, 2012
  3. roucherjJun 11, 2012
  4. konglu@minatec.inpg.frJun 11, 2012
  5. roucherjJun 11, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.