Discussion:
Use .authinfo for git credentials
Pierre Neidhardt
2018-04-25 09:23:11 UTC
Permalink
I would like `git send-email` to use the credentials from ~/.authinfo.gpg
to send patches to the Guix mailing list.

While not related to Guix code per se, I'm posting this here because I
primarily use `git send-email` for Guix and I suppose people around here
must have an answer to that question.

Or else how do you people configure `git send-email' to not prompt for a
password?

All I've found so far is this:

https://github.com/git/git/blob/master/contrib/credential/netrc/git-credential-netrc

--
Pierre Neidhardt

He laughs at every joke three times... once when it's told, once when
it's explained, and once when he understands it.
Marius Bakke
2018-04-25 10:07:35 UTC
Permalink
Post by Pierre Neidhardt
Or else how do you people configure `git send-email' to not prompt for a
password?
I use 'msmtp' as the transport and have configured it to look up
passwords from 'password-store'.

$ git config --get-regexp sendemail.*
sendemail.smtpserver /home/marius/.guix-profile/bin/msmtp
sendemail.envelopesender auto

My ~/.msmtprc contains a line such as
'passwordeval "pass Email/fm/mbakke/out 2>/dev/null"'. Obviously you
can use any other shell command here.

Hope this helps!
Pierre Neidhardt
2018-04-25 10:17:57 UTC
Permalink
Post by Marius Bakke
I use 'msmtp' as the transport and have configured it to look up
passwords from 'password-store'.
$ git config --get-regexp sendemail.*
sendemail.smtpserver /home/marius/.guix-profile/bin/msmtp
sendemail.envelopesender auto
From the (1)git-send-email man page:

--8<---------------cut here---------------start------------->8---
--smtp-server=<host>
If set, specifies the outgoing SMTP server to use (e.g.
smtp.example.com or a raw IP address). Alternatively it can specify
a full pathname of a sendmail-like program instead; the program
must support the -i option. Default value can be specified by the
sendemail.smtpServer configuration option; the built-in default is
to search for sendmail in /usr/sbin, /usr/lib and $PATH if such
program is available, falling back to localhost otherwise.
--8<---------------cut here---------------end--------------->8---

The smtp program must support the -i option.

I use Emacs' message-send to send e-mails.
I don't think Emacs accepts the -i option.

I could write a wrapper, but I don't think this is the most ideal
option.
--
Pierre Neidhardt

"Success covers a multitude of blunders."
-- George Bernard Shaw
Marius Bakke
2018-04-25 10:42:11 UTC
Permalink
Post by Pierre Neidhardt
Post by Marius Bakke
I use 'msmtp' as the transport and have configured it to look up
passwords from 'password-store'.
$ git config --get-regexp sendemail.*
sendemail.smtpserver /home/marius/.guix-profile/bin/msmtp
sendemail.envelopesender auto
--8<---------------cut here---------------start------------->8---
--smtp-server=<host>
If set, specifies the outgoing SMTP server to use (e.g.
smtp.example.com or a raw IP address). Alternatively it can specify
a full pathname of a sendmail-like program instead; the program
must support the -i option. Default value can be specified by the
sendemail.smtpServer configuration option; the built-in default is
to search for sendmail in /usr/sbin, /usr/lib and $PATH if such
program is available, falling back to localhost otherwise.
--8<---------------cut here---------------end--------------->8---
The smtp program must support the -i option.
I use Emacs' message-send to send e-mails.
I don't think Emacs accepts the -i option.
I could write a wrapper, but I don't think this is the most ideal
option.
I see. FWIW my emacs uses 'msmtp' too, with this snippet:

(setq mail-specify-envelope-from t
message-sendmail-envelope-from 'header
mail-envelope-from 'header
sendmail-program "/home/marius/.guix-profile/bin/msmtp"
mail-host-address "fastmail.com"
send-mail-function 'message-send-mail-with-sendmail
message-send-mail-function 'message-send-mail-with-sendmail
message-directory "~/Mail/drafts"
message-kill-buffer-on-exit t)
Efraim Flashner
2018-04-25 19:02:40 UTC
Permalink
Post by Marius Bakke
Post by Pierre Neidhardt
Or else how do you people configure `git send-email' to not prompt for a
password?
I use 'msmtp' as the transport and have configured it to look up
passwords from 'password-store'.
$ git config --get-regexp sendemail.*
sendemail.smtpserver /home/marius/.guix-profile/bin/msmtp
sendemail.envelopesender auto
My ~/.msmtprc contains a line such as
'passwordeval "pass Email/fm/mbakke/out 2>/dev/null"'. Obviously you
can use any other shell command here.
Hope this helps!
The similar line in my .msmtprc is:
passwordeval gpg --no-tty -q -d $HOME/.msmtp.password.gpg
--
Efraim Flashner <***@flashner.co.il> א׀ךים ׀לשנך
GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
Chris Marusich
2018-04-27 03:11:17 UTC
Permalink
Post by Pierre Neidhardt
I would like `git send-email` to use the credentials from ~/.authinfo.gpg
to send patches to the Guix mailing list.
While not related to Guix code per se, I'm posting this here because I
primarily use `git send-email` for Guix and I suppose people around here
must have an answer to that question.
Or else how do you people configure `git send-email' to not prompt for a
password?
https://github.com/git/git/blob/master/contrib/credential/netrc/git-credential-netrc
At first blush, this looks like the right solution given your problem
statement. I believe this is actually included in the Git source under
the contrib/credential subdirectory. We just don't build it today.
Perhaps you could submit a patch to build it? I wonder if it would be
simpler to define a separate package that builds it from the source
you've linked above, rather than trying to build it within the (already
rather large) Git package definition.

I type my password when I invoke git-send-email, and it makes me a
little sad inside every time, so I'd love to be able to use this!
--
Chris
Pierre Neidhardt
2018-04-27 09:23:46 UTC
Permalink
Yes, that sounds like the right approach. I'll look into packaging it then!
--
Pierre Neidhardt

The other line moves faster.
Loading...