{"thread":{"id":"53366","subject":"[PATCH] send-email: Defines smtpPassCmd config option","startedAt":"2020-05-01T10:52:56Z","lastAt":"2020-05-04T21:29:47Z","messageCount":13,"participants":["Leonardo Bras","Carlo Marcelo Arenas Belón","Junio C Hamano","Taylor Blau","brian m. carlson","Jeff King"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"396741","messageId":"20200501105131.297457-1-leobras.c@gmail.com","threadId":"53366","inReplyTo":null,"subject":"[PATCH] send-email: Defines smtpPassCmd config option","fromName":"Leonardo Bras","fromEmail":"leobras.c@gmail.com","sentAt":"2020-05-01T10:51:31Z","receivedAt":"2020-05-01T10:52:56Z","isPatch":true,"sender":{"key":"leobras.c@gmail.com","avatar":"https://gravatar.com/avatar/8cf0bacbc49005fcfeebf78e38bc89e01ce96b70c9260f45e0d55c1e1e5e1444?d=mp&s=160"},"body":"Defines smtpPassCmd config option, to allow the user to pass a command\nthat is used to output the password.\n\nIts useful for users that store the password encrypted on disk, and\nwant a easy way to send-email without typing it again.\n\nSigned-off-by: Leonardo Bras <leobras.c@gmail.com>\n---\n Documentation/config/sendemail.txt |  1 +\n Documentation/git-send-email.txt   |  5 +++--\n git-send-email.perl                | 11 +++++++++++\n 3 files changed, 15 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/config/sendemail.txt b/Documentation/config/sendemail.txt\nindex 0006faf800..f71e58862d 100644\n--- a/Documentation/config/sendemail.txt\n+++ b/Documentation/config/sendemail.txt\n@@ -34,6 +34,7 @@ sendemail.from::\n sendemail.multiEdit::\n sendemail.signedoffbycc::\n sendemail.smtpPass::\n+sendemail.smtpPassCmd::\n sendemail.suppresscc::\n sendemail.suppressFrom::\n sendemail.to::\ndiff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt\nindex 0a69810147..8e9da5ed64 100644\n--- a/Documentation/git-send-email.txt\n+++ b/Documentation/git-send-email.txt\n@@ -203,8 +203,9 @@ independently of `--smtp-user`\n Furthermore, passwords need not be specified in configuration files\n or on the command line. If a username has been specified (with\n `--smtp-user` or a `sendemail.smtpUser`), but no password has been\n-specified (with `--smtp-pass` or `sendemail.smtpPass`), then\n-a password is obtained using 'git-credential'.\n+specified (with `--smtp-pass` or `sendemail.smtpPass`, or as an output\n+of `sendemail.smtpPassCmd`), then a password is obtained using\n+'git-credential'.\n \n --no-smtp-auth::\n \tDisable SMTP authentication. Short hand for `--smtp-auth=none`\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex dc95656f75..d953ebb058 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -170,6 +170,7 @@ sub format_2822_time {\n my $smtp;\n my $auth;\n my $num_sent = 0;\n+my $smtp_authpass_cmd;\n \n # Regexes for RFC 2047 productions.\n my $re_token = qr/[^][()<>@,;:\\\\\"\\/?.= \\000-\\037\\177-\\377]+/;\n@@ -271,6 +272,7 @@ sub do_edit {\n     \"smtpserveroption\" => \\@smtp_server_options,\n     \"smtpuser\" => \\$smtp_authuser,\n     \"smtppass\" => \\$smtp_authpass,\n+    \"smtppasscmd\" => \\$smtp_authpass_cmd,\n     \"smtpdomain\" => \\$smtp_domain,\n     \"smtpauth\" => \\$smtp_auth,\n     \"smtpbatchsize\" => \\$batch_size,\n@@ -1303,6 +1305,15 @@ sub smtp_auth_maybe {\n \t\tdie \"invalid smtp auth: '${smtp_auth}'\";\n \t}\n \n+\t# Check password command if password was not provided.\n+\tif(!defined $smtp_authpass && defined $smtp_authpass_cmd){\n+\t\topen my $pass, \"$smtp_authpass_cmd |\"\n+\t\t\tor die sprintf(__(\"Could not execute '%s'\"), $smtp_authpass_cmd);\n+\t\t#Cut newline char\n+\t\t$smtp_authpass = substr <$pass>, 0, -1;\n+\t\tclose($pass);\n+\t}\n+\n \t# TODO: Authentication may fail not because credentials were\n \t# invalid but due to other reasons, in which we should not\n \t# reject credentials.\n-- \n2.25.4\n\n"},{"id":"396742","messageId":"20200501125308.GE33264@Carlos-MBP","threadId":"53366","inReplyTo":"20200501105131.297457-1-leobras.c@gmail.com","subject":"Re: [PATCH] send-email: Defines smtpPassCmd config option","fromName":"Carlo Marcelo Arenas Belón","fromEmail":"carenas@gmail.com","sentAt":"2020-05-01T12:53:08Z","receivedAt":"2020-05-01T12:53:13Z","isPatch":true,"sender":{"key":"carenas@gmail.com","avatar":"https://avatars.githubusercontent.com/u/76036?v=4"},"body":"On Fri, May 01, 2020 at 07:51:31AM -0300, Leonardo Bras wrote:\n> diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt\n> index 0a69810147..8e9da5ed64 100644\n> --- a/Documentation/git-send-email.txt\n> +++ b/Documentation/git-send-email.txt\n> @@ -203,8 +203,9 @@ independently of `--smtp-user`\n>  Furthermore, passwords need not be specified in configuration files\n>  or on the command line. If a username has been specified (with\n>  `--smtp-user` or a `sendemail.smtpUser`), but no password has been\n> -specified (with `--smtp-pass` or `sendemail.smtpPass`), then\n> -a password is obtained using 'git-credential'.\n> +specified (with `--smtp-pass` or `sendemail.smtpPass`, or as an output\n> +of `sendemail.smtpPassCmd`), then a password is obtained using\n> +'git-credential'.\n\nthis last part on git credential is just undocumented, since it is already\ndoing so since 4d31a44a08 (git-send-email: use git credential to obtain\npassword, 2013-02-12)\n \nand of course, assuming you use a credential helper that keeps the password\nencrypted you could use that instead of this new feature.\n\nhaving said that, this looks like a good alternative, but might need to\nmake sure if die makes sense below or would be better to see if you can\nstill get a password through git credential even if that fails.\n\nmaybe the rule of what to do might even need some configuration itself.\n\nCarlo\n"},{"id":"396770","messageId":"xmqqees3odrb.fsf@gitster.c.googlers.com","threadId":"53366","inReplyTo":"20200501125308.GE33264@Carlos-MBP","subject":"Re: [PATCH] send-email: Defines smtpPassCmd config option","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-05-01T15:50:48Z","receivedAt":"2020-05-01T15:50:56Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Carlo Marcelo Arenas Belón <carenas@gmail.com> writes:\n\n>> +of `sendemail.smtpPassCmd`), then a password is obtained using\n>> +'git-credential'.\n>\n> this last part on git credential is just undocumented, since it is already\n> doing so since 4d31a44a08 (git-send-email: use git credential to obtain\n> password, 2013-02-12)\n>  \n> and of course, assuming you use a credential helper that keeps the password\n> encrypted you could use that instead of this new feature.\n\nUp to this point I understand your response.\n\nDocumenting that \"git send-email\" can use \"git credential\" for its\npassword store, if it is not already documented, is of course a good\nchange.\n\nBut I am not sure why this is \"a good alternative\".  Having more\nchoices that do not offer anything substantially different is a bad\nthing.  Is this \"new mechanism\" better in what way?  Simpler to use?\nFaster?  Less error prone?  Something else?\n\nThanks.\n\n> having said that, this looks like a good alternative, but might need to\n> make sure if die makes sense below or would be better to see if you can\n> still get a password through git credential even if that fails.\n>\n> maybe the rule of what to do might even need some configuration itself.\n>\n> Carlo\n"},{"id":"396796","messageId":"20200501222723.GF41612@syl.local","threadId":"53366","inReplyTo":"xmqqees3odrb.fsf@gitster.c.googlers.com","subject":"Re: [PATCH] send-email: Defines smtpPassCmd config option","fromName":"Taylor Blau","fromEmail":"me@ttaylorr.com","sentAt":"2020-05-01T22:27:23Z","receivedAt":"2020-05-01T22:27:28Z","isPatch":true,"sender":{"key":"me@ttaylorr.com","avatar":"https://avatars.githubusercontent.com/u/301000140?v=4"},"body":"On Fri, May 01, 2020 at 08:50:48AM -0700, Junio C Hamano wrote:\n> Carlo Marcelo Arenas Belón <carenas@gmail.com> writes:\n>\n> >> +of `sendemail.smtpPassCmd`), then a password is obtained using\n> >> +'git-credential'.\n> >\n> > this last part on git credential is just undocumented, since it is already\n> > doing so since 4d31a44a08 (git-send-email: use git credential to obtain\n> > password, 2013-02-12)\n> >\n> > and of course, assuming you use a credential helper that keeps the password\n> > encrypted you could use that instead of this new feature.\n>\n> Up to this point I understand your response.\n>\n> Documenting that \"git send-email\" can use \"git credential\" for its\n> password store, if it is not already documented, is of course a good\n> change.\n\nI agree completely.\n\n> But I am not sure why this is \"a good alternative\".  Having more\n> choices that do not offer anything substantially different is a bad\n> thing.  Is this \"new mechanism\" better in what way?  Simpler to use?\n> Faster?  Less error prone?  Something else?\n\nDitto. I don't think that an increased surface-area of possibilities to\nspecify your password to 'git send-email' is useful. Put another way:\nwhy *not* use the in-built credential helper, which is already\nsupported?\n\nWould having it documented eliminate some rationale for invoking a\nseparate program?\n\n> Thanks.\n>\n> > having said that, this looks like a good alternative, but might need to\n> > make sure if die makes sense below or would be better to see if you can\n> > still get a password through git credential even if that fails.\n> >\n> > maybe the rule of what to do might even need some configuration itself.\n> >\n> > Carlo\n\nThanks,\nTaylor\n"},{"id":"396809","messageId":"20200501235948.GD6530@camp.crustytoothpaste.net","threadId":"53366","inReplyTo":"20200501222723.GF41612@syl.local","subject":"Re: [PATCH] send-email: Defines smtpPassCmd config option","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-05-01T23:59:48Z","receivedAt":"2020-05-01T23:59:58Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On 2020-05-01 at 22:27:23, Taylor Blau wrote:\n> On Fri, May 01, 2020 at 08:50:48AM -0700, Junio C Hamano wrote:\n> > Documenting that \"git send-email\" can use \"git credential\" for its\n> > password store, if it is not already documented, is of course a good\n> > change.\n> \n> I agree completely.\n\nI also concur.\n\n> > But I am not sure why this is \"a good alternative\".  Having more\n> > choices that do not offer anything substantially different is a bad\n> > thing.  Is this \"new mechanism\" better in what way?  Simpler to use?\n> > Faster?  Less error prone?  Something else?\n> \n> Ditto. I don't think that an increased surface-area of possibilities to\n> specify your password to 'git send-email' is useful. Put another way:\n> why *not* use the in-built credential helper, which is already\n> supported?\n> \n> Would having it documented eliminate some rationale for invoking a\n> separate program?\n\nI think perhaps many folks aren't aware that you can invoke Git with an\narbitrary shell command as \"credential.helper\", which of course makes\nlife a lot easier.  So if you want to invoke a separate command, it's\nreally as easy as this:\n\n  git config credential.smtp://smtp.crustytoothpaste.net.helper \\\n    '!f() { echo username=my-username; echo \"password=$(my-password-command)\"; }; f'\n\nSo I think that documenting the use of the credential helper is step 1,\nbecause probably most people _do_ want to use that for their passwords,\nand then documenting that credential helpers can be arbitrary shell\ncommands that speak the protocol is step 2, so that people who don't can\nfigure out a way to do what they want.\n\nI'll send some patches later which document the latter feature, since I\ndon't think we mention it anywhere outside of the FAQ.  I actually\ndidn't know about it until Peff mentioned it to me one time.\n-- \nbrian m. carlson: Houston, Texas, US\nOpenPGP: https://keybase.io/bk2204\n"},{"id":"396865","messageId":"20200503094348.GE170902@coredump.intra.peff.net","threadId":"53366","inReplyTo":"20200501235948.GD6530@camp.crustytoothpaste.net","subject":"Re: [PATCH] send-email: Defines smtpPassCmd config option","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2020-05-03T09:43:48Z","receivedAt":"2020-05-03T09:43:53Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, May 01, 2020 at 11:59:48PM +0000, brian m. carlson wrote:\n\n> I think perhaps many folks aren't aware that you can invoke Git with an\n> arbitrary shell command as \"credential.helper\", which of course makes\n> life a lot easier.  So if you want to invoke a separate command, it's\n> really as easy as this:\n> \n>   git config credential.smtp://smtp.crustytoothpaste.net.helper \\\n>     '!f() { echo username=my-username; echo \"password=$(my-password-command)\"; }; f'\n> \n> So I think that documenting the use of the credential helper is step 1,\n> because probably most people _do_ want to use that for their passwords,\n> and then documenting that credential helpers can be arbitrary shell\n> commands that speak the protocol is step 2, so that people who don't can\n> figure out a way to do what they want.\n> \n> I'll send some patches later which document the latter feature, since I\n> don't think we mention it anywhere outside of the FAQ.  I actually\n> didn't know about it until Peff mentioned it to me one time.\n\nThis is documented, but only recently did it make it out of\nDocumentation/technical/ and into gitcredentials(7). I don't mind adding\nmore pointers, though.\n\nIt's also being discussed in this thread:\n\n  https://lore.kernel.org/git/63f35287c9ced4d674f938bedd439aefa6c46f41.camel@gmail.com/\n\nabout how deep into the rabbit-hole we want to go in terms of showing a\nworking example. In particular, in your example above I'd consider\nchecking that \"$1\" is \"get\" in the function.\n\nYou also could be using credential.*.username. It's twice as many\ngit-config commands to set up on the command-line, but IMHO the\nresulting config file is a little easier to read.\n\n-Peff\n"},{"id":"396873","messageId":"20200503162757.GE6530@camp.crustytoothpaste.net","threadId":"53366","inReplyTo":"20200503094348.GE170902@coredump.intra.peff.net","subject":"Re: [PATCH] send-email: Defines smtpPassCmd config option","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-05-03T16:27:57Z","receivedAt":"2020-05-03T16:28:06Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On 2020-05-03 at 09:43:48, Jeff King wrote:\n> On Fri, May 01, 2020 at 11:59:48PM +0000, brian m. carlson wrote:\n> \n> > I think perhaps many folks aren't aware that you can invoke Git with an\n> > arbitrary shell command as \"credential.helper\", which of course makes\n> > life a lot easier.  So if you want to invoke a separate command, it's\n> > really as easy as this:\n> > \n> >   git config credential.smtp://smtp.crustytoothpaste.net.helper \\\n> >     '!f() { echo username=my-username; echo \"password=$(my-password-command)\"; }; f'\n> > \n> > So I think that documenting the use of the credential helper is step 1,\n> > because probably most people _do_ want to use that for their passwords,\n> > and then documenting that credential helpers can be arbitrary shell\n> > commands that speak the protocol is step 2, so that people who don't can\n> > figure out a way to do what they want.\n> > \n> > I'll send some patches later which document the latter feature, since I\n> > don't think we mention it anywhere outside of the FAQ.  I actually\n> > didn't know about it until Peff mentioned it to me one time.\n> \n> This is documented, but only recently did it make it out of\n> Documentation/technical/ and into gitcredentials(7). I don't mind adding\n> more pointers, though.\n\nAh, yes, I remembered that series, but forgot that it introduced\ndocumentation for that.\n\nI'll just send a patch that updates the config option to mention the\nother cases, since we already document it in gitcredentials(7).\n-- \nbrian m. carlson: Houston, Texas, US\nOpenPGP: https://keybase.io/bk2204\n"},{"id":"396882","messageId":"20200503234834.GA86805@Carlos-MBP","threadId":"53366","inReplyTo":"20200503162757.GE6530@camp.crustytoothpaste.net","subject":"Re: [PATCH] send-email: Defines smtpPassCmd config option","fromName":"Carlo Marcelo Arenas Belón","fromEmail":"carenas@gmail.com","sentAt":"2020-05-03T23:48:34Z","receivedAt":"2020-05-03T23:48:40Z","isPatch":true,"sender":{"key":"carenas@gmail.com","avatar":"https://avatars.githubusercontent.com/u/76036?v=4"},"body":"On Sun, May 03, 2020 at 04:27:57PM +0000, brian m. carlson wrote:\n> On 2020-05-03 at 09:43:48, Jeff King wrote:\n> > On Fri, May 01, 2020 at 11:59:48PM +0000, brian m. carlson wrote:\n> > \n> > > I think perhaps many folks aren't aware that you can invoke Git with an\n> > > arbitrary shell command as \"credential.helper\", which of course makes\n> > > life a lot easier.  So if you want to invoke a separate command, it's\n> > > really as easy as this:\n> > > \n> > >   git config credential.smtp://smtp.crustytoothpaste.net.helper \\\n> > >     '!f() { echo username=my-username; echo \"password=$(my-password-command)\"; }; f'\n> > > \n> > > So I think that documenting the use of the credential helper is step 1,\n> > > because probably most people _do_ want to use that for their passwords,\n> > > and then documenting that credential helpers can be arbitrary shell\n> > > commands that speak the protocol is step 2, so that people who don't can\n> > > figure out a way to do what they want.\n> > > \n> > > I'll send some patches later which document the latter feature, since I\n> > > don't think we mention it anywhere outside of the FAQ.  I actually\n> > > didn't know about it until Peff mentioned it to me one time.\n> > \n> > This is documented, but only recently did it make it out of\n> > Documentation/technical/ and into gitcredentials(7). I don't mind adding\n> > more pointers, though.\n> \n> Ah, yes, I remembered that series, but forgot that it introduced\n> documentation for that.\n\nif we are going to mention an example or a credential helper specially\ntailored to smtp, then the recently reintroduced syntax by Dscho in\n9a121b0d22 (credential: handle `credential.<partial-URL>.<key>` again,\n2020-04-24), might come up handy IMHO.\n\nCarlo\n"},{"id":"396954","messageId":"6abf695198e969898c56669bd884f2679aebd35a.camel@gmail.com","threadId":"53366","inReplyTo":"20200501125308.GE33264@Carlos-MBP","subject":"Re: [PATCH] send-email: Defines smtpPassCmd config option","fromName":"Leonardo Bras","fromEmail":"leobras.c@gmail.com","sentAt":"2020-05-04T19:02:45Z","receivedAt":"2020-05-04T19:02:59Z","isPatch":true,"sender":{"key":"leobras.c@gmail.com","avatar":"https://gravatar.com/avatar/8cf0bacbc49005fcfeebf78e38bc89e01ce96b70c9260f45e0d55c1e1e5e1444?d=mp&s=160"},"body":"On Fri, 2020-05-01 at 05:53 -0700, Carlo Marcelo Arenas Belón wrote:\n> having said that, this looks like a good alternative, but might need to\n> make sure if die makes sense below or would be better to see if you can\n> still get a password through git credential even if that fails.\n\nThank you.\n\n"},{"id":"396969","messageId":"aeff4d773cc69b6845e89a79a6de79d3137b7da2.camel@gmail.com","threadId":"53366","inReplyTo":"xmqqees3odrb.fsf@gitster.c.googlers.com","subject":"Re: [PATCH] send-email: Defines smtpPassCmd config option","fromName":"Leonardo Bras","fromEmail":"leobras.c@gmail.com","sentAt":"2020-05-04T19:09:07Z","receivedAt":"2020-05-04T19:09:28Z","isPatch":true,"sender":{"key":"leobras.c@gmail.com","avatar":"https://gravatar.com/avatar/8cf0bacbc49005fcfeebf78e38bc89e01ce96b70c9260f45e0d55c1e1e5e1444?d=mp&s=160"},"body":"On Fri, 2020-05-01 at 08:50 -0700, Junio C Hamano wrote:\n> Carlo Marcelo Arenas Belón <carenas@gmail.com> writes:\n> \n> > > +of `sendemail.smtpPassCmd`), then a password is obtained using\n> > > +'git-credential'.\n> > \n> > this last part on git credential is just undocumented, since it is already\n> > doing so since 4d31a44a08 (git-send-email: use git credential to obtain\n> > password, 2013-02-12)\n> >  \n> > and of course, assuming you use a credential helper that keeps the password\n> > encrypted you could use that instead of this new feature.\n> \n> Up to this point I understand your response.\n> \n> Documenting that \"git send-email\" can use \"git credential\" for its\n> password store, if it is not already documented, is of course a good\n> change.\n> \n> But I am not sure why this is \"a good alternative\".  Having more\n> choices that do not offer anything substantially different is a bad\n> thing.  Is this \"new mechanism\" better in what way?  Simpler to use?\n> Faster?  Less error prone?  Something else?\n\nThe main reason would be \"simpler to use\".\nAt the point the developer is configuring smtp, adding another line\nwith 'command to get the password' instead of 'password' is way more\nintuitive than configure a credential.\n\nBest regards,\nLeonardo Bras\n\n"},{"id":"396975","messageId":"306703d7687377d6a74ec9f1d63331580a3c109b.camel@gmail.com","threadId":"53366","inReplyTo":"20200501235948.GD6530@camp.crustytoothpaste.net","subject":"Re: [PATCH] send-email: Defines smtpPassCmd config option","fromName":"Leonardo Bras","fromEmail":"leobras.c@gmail.com","sentAt":"2020-05-04T19:49:09Z","receivedAt":"2020-05-04T19:49:35Z","isPatch":true,"sender":{"key":"leobras.c@gmail.com","avatar":"https://gravatar.com/avatar/8cf0bacbc49005fcfeebf78e38bc89e01ce96b70c9260f45e0d55c1e1e5e1444?d=mp&s=160"},"body":"On Fri, 2020-05-01 at 23:59 +0000, brian m. carlson wrote:\n>   git config credential.smtp://smtp.crustytoothpaste.net.helper \\\n>     '!f() { echo username=my-username; echo \"password=$(my-password-command)\"; }; f'\n\nI have tried doing this, with --global, and my config file changed like\nthis:\n\n[credential \"smtp://smtp.gmail.com\"]\n        helper = \"!f() { echo username=mymail@gmail.com; echo\n\\\"password=$(gpg2 -q --for-your-eyes-only --no-tty -d ~/words/imap)\\\";\n}; f\"\n\nWhile sendemail has:\n[sendemail]\n        smtpServer = smtp.gmail.com\n        smtpServerPort = 587\n        smtpEncryption = tls\n        smtpUser = mymail@gmail.com\n\nYet still,  I was asked for password:\nPassword for 'smtp://mymail@gmail.com@smtp.gmail.com:587': \n\nWhat have I done wrong?\n\nBest regards,\nLeonardo Bras\n\n"},{"id":"396982","messageId":"20200504203556.GA28192@coredump.intra.peff.net","threadId":"53366","inReplyTo":"306703d7687377d6a74ec9f1d63331580a3c109b.camel@gmail.com","subject":"Re: [PATCH] send-email: Defines smtpPassCmd config option","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2020-05-04T20:35:56Z","receivedAt":"2020-05-04T20:35:59Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, May 04, 2020 at 04:49:09PM -0300, Leonardo Bras wrote:\n\n> On Fri, 2020-05-01 at 23:59 +0000, brian m. carlson wrote:\n> >   git config credential.smtp://smtp.crustytoothpaste.net.helper \\\n> >     '!f() { echo username=my-username; echo \"password=$(my-password-command)\"; }; f'\n> \n> I have tried doing this, with --global, and my config file changed like\n> this:\n> \n> [credential \"smtp://smtp.gmail.com\"]\n>         helper = \"!f() { echo username=mymail@gmail.com; echo\n> \\\"password=$(gpg2 -q --for-your-eyes-only --no-tty -d ~/words/imap)\\\";\n> }; f\"\n> \n> While sendemail has:\n> [sendemail]\n>         smtpServer = smtp.gmail.com\n>         smtpServerPort = 587\n>         smtpEncryption = tls\n>         smtpUser = mymail@gmail.com\n> \n> Yet still,  I was asked for password:\n> Password for 'smtp://mymail@gmail.com@smtp.gmail.com:587': \n\nI think the way the host-matching works, you'd need to put the \":587\"\ninto the credential.*.url config section heading for it to match.\n\n-Peff\n"},{"id":"396992","messageId":"d2bc3b0ff43461f14ca7b532554759169cda9e83.camel@gmail.com","threadId":"53366","inReplyTo":"20200504203556.GA28192@coredump.intra.peff.net","subject":"Re: [PATCH] send-email: Defines smtpPassCmd config option","fromName":"Leonardo Bras","fromEmail":"leobras.c@gmail.com","sentAt":"2020-05-04T21:29:29Z","receivedAt":"2020-05-04T21:29:47Z","isPatch":true,"sender":{"key":"leobras.c@gmail.com","avatar":"https://gravatar.com/avatar/8cf0bacbc49005fcfeebf78e38bc89e01ce96b70c9260f45e0d55c1e1e5e1444?d=mp&s=160"},"body":"On Mon, 2020-05-04 at 16:35 -0400, Jeff King wrote:\n> Yet still,  I was asked for password:\n> > Password for 'smtp://mymail@gmail.com@smtp.gmail.com:587': \n> \n> I think the way the host-matching works, you'd need to put the \":587\"\n> into the credential.*.url config section heading for it to match.\n\nOh, that makes sense.\nIt works, thanks!\n\n"}]}