Skip to content

Commit e774d20

Browse files
committed
Merge branch 'ag/doc-send-email' into jch
* ag/doc-send-email: docs: add credential helper for outlook and gmail in OAuth list of helpers docs: improve send-email documentation send-mail: improve checks for valid_fqdn
2 parents 5de2e33 + cbc5343 commit e774d20

File tree

3 files changed

+59
-9
lines changed

3 files changed

+59
-9
lines changed

Documentation/git-send-email.adoc

Lines changed: 53 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -509,12 +509,12 @@ include::includes/cmd-config-section-all.adoc[]
509509

510510
include::config/sendemail.adoc[]
511511

512-
EXAMPLES
513-
--------
514-
Use gmail as the smtp server
512+
EXAMPLES OF SMTP SERVERS
513+
------------------------
514+
Use Gmail as the SMTP Server
515515
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
516-
To use 'git send-email' to send your patches through the GMail SMTP server,
517-
edit ~/.gitconfig to specify your account settings:
516+
To use 'git send-email' to send your patches through the Gmail SMTP server,
517+
edit '~/.gitconfig' to specify your account settings:
518518

519519
----
520520
[sendemail]
@@ -528,6 +528,37 @@ If you have multi-factor authentication set up on your Gmail account, you can
528528
generate an app-specific password for use with 'git send-email'. Visit
529529
https://security.google.com/settings/security/apppasswords to create it.
530530

531+
You can also use OAuth2.0 authentication with Gmail. To do this, edit your
532+
`~/.gitconfig` file and add `smtpAuth = OAUTHBEARER` to your account settings:
533+
534+
----
535+
[sendemail]
536+
smtpEncryption = tls
537+
smtpServer = smtp.gmail.com
538+
smtpUser = [email protected]
539+
smtpServerPort = 587
540+
smtpAuth = OAUTHBEARER
541+
----
542+
543+
Use Microsoft Outlook as the SMTP Server
544+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
545+
Unlike Gmail, Microsoft Outlook no longer supports app-specific passwords.
546+
Therefore, OAuth2.0 authentication must be used for Outlook.
547+
548+
Edit '~/.gitconfig' to specify your account settings for Outlook and use its
549+
SMTP server with 'git send-email':
550+
551+
----
552+
[sendemail]
553+
smtpEncryption = tls
554+
smtpServer = smtp.office365.com
555+
smtpUser = [email protected]
556+
smtpServerPort = 587
557+
smtpAuth = XOAUTH2
558+
----
559+
560+
SENDING PATCHES
561+
---------------
531562
Once your commits are ready to be sent to the mailing list, run the
532563
following commands:
533564

@@ -536,9 +567,23 @@ following commands:
536567
$ git send-email outgoing/*
537568

538569
The first time you run it, you will be prompted for your credentials. Enter the
539-
app-specific or your regular password as appropriate. If you have credential
540-
helper configured (see linkgit:git-credential[1]), the password will be saved in
541-
the credential store so you won't have to type it the next time.
570+
app-specific or your regular password as appropriate.
571+
572+
If you have a credential helper configured (see linkgit:git-credential[1]), the
573+
password will be saved in the credential store so you won't have to type it the
574+
next time.
575+
576+
If you are using OAuth2.0 authentication, you need to use an access token in
577+
place of a password when prompted. Various OAuth2.0 token generators are
578+
available online. Community maintained credential helpers for Gmail and Outlook
579+
are also available:
580+
581+
- https://github.com/AdityaGarg8/git-credential-email[git-credential-gmail] (cross platform, dedicated helper for authenticating Gmail accounts)
582+
583+
- https://github.com/AdityaGarg8/git-credential-email[git-credential-outlook] (cross platform, dedicated helper for authenticating Microsoft Outlook accounts)
584+
585+
You can also see linkgit:gitcredentials[7] for more OAuth based authentication
586+
helpers.
542587

543588
Note: the following core Perl modules that may be installed with your
544589
distribution of Perl are required:

Documentation/gitcredentials.adoc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,10 @@ Popular helpers with OAuth support include:
133133

134134
- https://github.com/hickford/git-credential-oauth[git-credential-oauth] (cross platform, included in many Linux distributions)
135135

136+
- https://github.com/AdityaGarg8/git-credential-email[git-credential-gmail] (cross platform, dedicated helper to authenticate Gmail accounts for linkgit:git-send-email[1])
137+
138+
- https://github.com/AdityaGarg8/git-credential-email[git-credential-outlook] (cross platform, dedicated helper to authenticate Microsoft Outlook accounts for linkgit:git-send-email[1])
139+
136140
CREDENTIAL CONTEXTS
137141
-------------------
138142

git-send-email.perl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1359,7 +1359,8 @@ sub process_address_list {
13591359

13601360
sub valid_fqdn {
13611361
my $domain = shift;
1362-
return defined $domain && !($^O eq 'darwin' && $domain =~ /\.local$/) && $domain =~ /\./;
1362+
return defined $domain && !($^O eq 'darwin' && $domain =~ /\.local$/)
1363+
&& $domain =~ /^(?!-)[A-Za-z0-9-]{1,63}(?<!-)(\.(?!-)[A-Za-z0-9-]{1,63}(?<!-))*$/;
13631364
}
13641365

13651366
sub maildomain_net {

0 commit comments

Comments
 (0)