diff options
| author | Junio C Hamano <gitster@pobox.com> | 2025-05-19 16:02:45 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-05-19 16:02:45 -0700 |
| commit | ae0b60e0095a118af7bb4026622d8c308e0a4c52 (patch) | |
| tree | 04d0b6276ab833f075589a15117b95d6a847249d | |
| parent | 4bb72548fcf486e136029005c7087cbb7e0404f6 (diff) | |
| parent | ba998f61072943aa8205bfaf966412ecc9cb7af9 (diff) | |
| download | git-ae0b60e0095a118af7bb4026622d8c308e0a4c52.tar.gz | |
Merge branch 'ag/doc-send-email'
The `send-email` documentation has been updated with OAuth2.0
related examples.
* 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
| -rw-r--r-- | Documentation/git-send-email.adoc | 67 | ||||
| -rw-r--r-- | Documentation/gitcredentials.adoc | 4 | ||||
| -rwxr-xr-x | git-send-email.perl | 4 |
3 files changed, 66 insertions, 9 deletions
diff --git a/Documentation/git-send-email.adoc b/Documentation/git-send-email.adoc index 92389036fa..26fda63c2f 100644 --- a/Documentation/git-send-email.adoc +++ b/Documentation/git-send-email.adoc @@ -509,12 +509,12 @@ include::includes/cmd-config-section-all.adoc[] include::config/sendemail.adoc[] -EXAMPLES --------- -Use gmail as the smtp server +EXAMPLES OF SMTP SERVERS +------------------------ +Use Gmail as the SMTP Server ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -To use 'git send-email' to send your patches through the GMail SMTP server, -edit ~/.gitconfig to specify your account settings: +To use `git send-email` to send your patches through the Gmail SMTP server, +edit `~/.gitconfig` to specify your account settings: ---- [sendemail] @@ -528,6 +528,41 @@ If you have multi-factor authentication set up on your Gmail account, you can generate an app-specific password for use with 'git send-email'. Visit https://security.google.com/settings/security/apppasswords to create it. +You can also use OAuth2.0 authentication with Gmail. `OAUTHBEARER` and +`XOAUTH2` are common methods used for this type of authentication. Gmail +supports both of them. As an example, if you want to use `OAUTHBEARER`, edit +your `~/.gitconfig` file and add `smtpAuth = OAUTHBEARER` to your account +settings: + +---- +[sendemail] + smtpEncryption = tls + smtpServer = smtp.gmail.com + smtpUser = yourname@gmail.com + smtpServerPort = 587 + smtpAuth = OAUTHBEARER +---- + +Use Microsoft Outlook as the SMTP Server +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Unlike Gmail, Microsoft Outlook no longer supports app-specific passwords. +Therefore, OAuth2.0 authentication must be used for Outlook. Also, it only +supports `XOAUTH2` authentication method. + +Edit `~/.gitconfig` to specify your account settings for Outlook and use its +SMTP server with `git send-email`: + +---- +[sendemail] + smtpEncryption = tls + smtpServer = smtp.office365.com + smtpUser = yourname@outlook.com + smtpServerPort = 587 + smtpAuth = XOAUTH2 +---- + +SENDING PATCHES +--------------- Once your commits are ready to be sent to the mailing list, run the following commands: @@ -536,9 +571,25 @@ following commands: $ git send-email outgoing/* The first time you run it, you will be prompted for your credentials. Enter the -app-specific or your regular password as appropriate. If you have credential -helper configured (see linkgit:git-credential[1]), the password will be saved in -the credential store so you won't have to type it the next time. +app-specific or your regular password as appropriate. + +If you have a credential helper configured (see linkgit:git-credential[1]), the +password will be saved in the credential store so you won't have to type it the +next time. + +If you are using OAuth2.0 authentication, you need to use an access token in +place of a password when prompted. Various OAuth2.0 token generators are +available online. Community maintained credential helpers for Gmail and Outlook +are also available: + + - https://github.com/AdityaGarg8/git-credential-email[git-credential-gmail] + (cross platform, dedicated helper for authenticating Gmail accounts) + + - https://github.com/AdityaGarg8/git-credential-email[git-credential-outlook] + (cross platform, dedicated helper for authenticating Microsoft Outlook accounts) + +You can also see linkgit:gitcredentials[7] for more OAuth based authentication +helpers. Note: the following core Perl modules that may be installed with your distribution of Perl are required: diff --git a/Documentation/gitcredentials.adoc b/Documentation/gitcredentials.adoc index 3337bb475d..b49923db02 100644 --- a/Documentation/gitcredentials.adoc +++ b/Documentation/gitcredentials.adoc @@ -133,6 +133,10 @@ Popular helpers with OAuth support include: - https://github.com/hickford/git-credential-oauth[git-credential-oauth] (cross platform, included in many Linux distributions) + - https://github.com/AdityaGarg8/git-credential-email[git-credential-gmail] (cross platform, dedicated helper to authenticate Gmail accounts for linkgit:git-send-email[1]) + + - 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]) + CREDENTIAL CONTEXTS ------------------- diff --git a/git-send-email.perl b/git-send-email.perl index 4215f8f7e9..55b7e00d29 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -1359,7 +1359,9 @@ sub process_address_list { sub valid_fqdn { my $domain = shift; - return defined $domain && !($^O eq 'darwin' && $domain =~ /\.local$/) && $domain =~ /\./; + my $subdomain = '(?!-)[A-Za-z0-9-]{1,63}(?<!-)'; + return defined $domain && !($^O eq 'darwin' && $domain =~ /\.local$/) + && $domain =~ /^$subdomain(?:\.$subdomain)*$/; } sub maildomain_net { |
