Re: Git ksshaskpass to play nice with https and kwallet
- From
Michael J Gruber <git@drmicha.warpmail.net>
- Date
- Oct 4, 2011, 12:12 UTC
- Message-ID
- <4E8AF812.5090906@drmicha.warpmail.net>
- In-Reply-To
- <20111004113713.GA19171@sigill.intra.peff.net>
Jeff King venit, vidit, dixit 04.10.2011 13:37:
Show 29 quoted lines
> On Tue, Oct 04, 2011 at 01:27:57PM +0200, Michael J Gruber wrote: > >> Still, ksshaskpass's trying to guess a unique key from the prompt text >> seems quite hackish to me. But many people will have a Git without >> credential-helpers, and a KDE default setup, so hope my post helps >> someone besides myself. > > Hmm. I don't think that pre-credential-helper git actually puts the > hostname in the prompt, though. It just says "Username:". So your trick > wouldn't work then, would it? > >> Note that git-credentials-askpass would have a fair chance of doing >> better: credential_askpass() knows the username and could pass it to >> credential_ask_one(), e.g. by amending the description field, or setting >> the first field to "Password for user %(user)". Do you think that would >> be worth deviating from the default behavior (i.e. compared to no helper)? > > I think that git should do that by default. v1.7.7 (and earlier) does: > > $ git push https://example.com/foo.git > Username: > Password: > > With my patches in 'next', it does: > > $ git push https://example.com/foo.git > Username for 'example.com': > Password for 'example.com': >
Sheesh. I'm too used to using next(+) to even think of that! You're completely right: My trick only works with next's additions.
Show 5 quoted lines
> But it would probably be better to say: > > $ git push https://example.com/foo.git > Username for 'example.com': > Password for 'user@example.com':
Yes, exactly. credential_askpass() knows what it needs for that.
> The latter is especially useful if you have put a username in your > ~/.gitconfig, in which case you get:
I'm actually wondering why git can't infer the user from
https://user@host.com
with last week's next, at least.
Show 8 quoted lines
> > $ git push https://example.com/foo.git > Password for 'user@example.com': > > which is a nice reminder. And it would happen to work with your askpass > magic (I also wonder if it should mention the protocol and the repo, but > most of the time that isn't relevant, and it does make the prompt harder > to read).
With the above, I can probably do without any magic: 'example.com' would be the wallet key for the username (if I let the wallet store it) and 'user@example.com' the key for the password, whether the username comes from the wallet or from the config. (Again, why not from the URL?)
Michael