You only need to complete this step once for each machine you intend to send emails from.
git config --global --editto open your global configuration file in your default editor.
There are two possible ways of using Gmail with
First, make sure that two-factor authentication is enabled for your Google
account. Then, obtain an application-specific password
for git from the app passwords page. To store this password with git,
run this command:
git config --global sendemail.smtpPass 'your password'Next step is to add these details to your global configuration file:
[sendemail] smtpserver = smtp.gmail.com smtpuser = firstname.lastname@example.org smtpencryption = tls smtpserverport = 587Be sure to fill in your own email address under
It is still possible to use
git send-emailwithout two-factor authentication and application-specific password, but this requires installation and configuration of the special tool, which mimics regular
Also, if you haven't yet, run these commands - again, making the appropriate changes:
git config --global user.email "email@example.com" git config --global user.name "Your Name"Next
Protonmail does not support the open, industry-standard protocols necessary for git send-email to work out-of-the-box. To solve this, Protonmail offers Protonmail Bridge. Otherwise, you need to install & configure Hydroxide to connect to Protonmail with SMTP. Once you have configured Protonmail Bridge or Hydroxide, use its SMTP details along with the generic instructions below.
Protonmail bridge users: the bridge uses SSL authentication, but it self-signs the certificate used for SSL, so you will need to disable SSL verification with the daemon in your git config by setting an empty value for sendemail.smtpsslcertpath.
Visit the Fastmail instructions for adding a new third-party app. Add the following details, making the appropriate changes, including the "app password" that was generated from following those Fastmail instructions:
[sendemail] smtpserver = smtp.fastmail.com smtpuser = firstname.lastname@example.org smtpencryption = ssl smtpserverport = 465 smtppass = whatwasautogenerated
Also, if you haven't yet, run these commands - again making the appropriate changes:
git config --global user.email "email@example.com" git config --global user.name "Your Name"
If you already have an SMTP client installed, you can configure
git send-email to use it by setting its command with
sendemail.sendmailCmd. For example, to use msmtp you
could add this to your global configuration file:
[sendemail] sendmailCmd = /usr/bin/msmtp
If you have multiple accounts configured for your SMTP client and want to
specify one, you can add the required command parameters in the
sendemail.sendmailCmd setting. For example, to choose an account
work configured for msmtp:
[sendemail] sendmailCmd = /usr/bin/msmtp -a work
Please note that the
was added in Git 2.33. If you use an older version of Git, you must
add the path to your SMTP client as
parameters as multiple
sendemail.smtpserveroption. For example,
the previous msmtp configuration would be:
[sendemail] smtpserver = /usr/bin/msmtp smtpserveroption = -a smtpserveroption = workNext
Your email provider should have instructions somewhere for SMTP access. Look these details up, and then add the following details from your mail provider:
[sendemail] smtpserver = mail.example.org smtpuser = firstname.lastname@example.org smtpencryption = ssl smtpserverport = 465
Be sure to fill in the appropriate values for your email
provider - you will probably only have to fill in
smtpuser. Also, if
you haven't yet, run these commands - again, making the
git config --global user.email "email@example.com" git config --global user.name "Your Name"Next
This configuration assumes direct TLS. If your provider only
offers STARTTLS, set
smtpencryption = tls and
smtpserverport = 587.
If your system is already set up with
you may skip the
[sendemail] git configuration instructions.