我无法设置 git send-mail 来发送补丁。
os platform: Ubuntu22.04 LTS
linux kernel: 5.15.0-58-generic
git virsion: 2.34.1
我遵循这两个指南。
- git 设置指南
- 微软 smtp 配置
vishi@striker:~/$ cat ~/.gitconfig [user] name = vishalsinh email = [email protected] [core] autocrlf = false [sendemail] smtpencryption = STARTTLS smtpserver = smtp.office365.com smtpUser = [email protected] smtpServerPort = 587 confirm = auto
以此方式使用命令。
vishi@striker:~/$ ls outgoing/
0000-cover-letter.patch 0001-PATCH-test.patch
vishi@striker:~/$ git send-email outgoing/* --smtp-debug=1
我收到以下错误。
Net::SMTP>>> Net::SMTP(3.13)
Net::SMTP>>> Net::Cmd(3.13)
Net::SMTP>>> Exporter(5.76)
Net::SMTP>>> IO::Socket::IP(0.41)
Net::SMTP>>> IO::Socket(1.46)
Net::SMTP>>> IO::Handle(1.46)
Net::SMTP=GLOB(0x561947328538)<<< 220 PN2PR01CA0160.outlook.office365.com Microsoft ESMTP MAIL Service ready at Mon, 23 Jan 2023 14:41:27 +0000
Net::SMTP=GLOB(0x561947328538)>>> EHLO striker..
Net::SMTP=GLOB(0x561947328538)<<< 501 5.5.4 Invalid domain name [PN2PR01CA0160.INDPRD01.PROD.OUTLOOK.COM]
Net::SMTP=GLOB(0x561947328538)>>> HELO striker..
Net::SMTP=GLOB(0x561947328538)<<< 501 5.5.4 Invalid domain name [PN2PR01CA0160.INDPRD01.PROD.OUTLOOK.COM]
Unable to initialize SMTP properly. Check config and use --smtp-debug. VALUES: server=smtp.office365.com encryption=STARTTLS hello=striker.. port=587 at /usr/lib/git-core/git-send-email line 1648.
请提供一些提示或文档以供我参考解决问题。
更新日期:2023 年 1 月 31 日
今天我通过下面的命令专门添加域名解决了域名问题。之后出现了加密身份验证未知问题,因为 git send-email 没有“STARTTLS”(git 有 TLS/SSL 加密)。所以将其设置为“tls”
git config --global sendemail.smtpDomain "siliconsignals.io"
git config --global sendemail.smtpencryption tls
现在,微软 AAD(Azure Active Directory)的安全默认值禁用 SMTP 身份验证。所以我收到以下错误。
带有调试日志:
$ git send-email [email protected] outgoing/* --smtp-debug=1
outgoing/0001-biuld-bootloader-host-in-AI-100-so-it-will-work-out-.patch
(mbox) Adding cc: vishalsinh_sisignals <[email protected]> from line 'From: vishalsinh_sisignals <[email protected]>'
From: vishalsinh <[email protected]>
To: [email protected]
Cc: vishalsinh_sisignals <[email protected]>
Subject: [PATCH] biuld bootloader host in AI-100 so it will work out of box
Date: Tue, 31 Jan 2023 15:48:39 +0530
Message-Id: <[email protected]>
X-Mailer: git-send-email 2.34.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
The Cc list above has been expanded by additional
addresses found in the patch commit message. By default
send-email prompts before sending whenever this occurs.
This behavior is controlled by the sendemail.confirm
configuration setting.
For additional information, run 'git send-email --help'.
To retain the current behavior, but squelch this message,
run 'git config --global sendemail.confirm auto'.
Send this email? ([y]es|[n]o|[e]dit|[q]uit|[a]ll): y
Net::SMTP>>> Net::SMTP(3.13)
Net::SMTP>>> Net::Cmd(3.13)
Net::SMTP>>> Exporter(5.76)
Net::SMTP>>> IO::Socket::IP(0.41)
Net::SMTP>>> IO::Socket(1.46)
Net::SMTP>>> IO::Handle(1.46)
Net::SMTP=GLOB(0x55f2e33df4e0)<<< 220 BM1PR01CA0158.outlook.office365.com Microsoft ESMTP MAIL Service ready at Tue, 31 Jan 2023 10:18:41 +0000
Net::SMTP=GLOB(0x55f2e33df4e0)>>> EHLO siliconsignals.io
Net::SMTP=GLOB(0x55f2e33df4e0)<<< 250-BM1PR01CA0158.outlook.office365.com Hello [122.170.105.202]
Net::SMTP=GLOB(0x55f2e33df4e0)<<< 250-SIZE 157286400
Net::SMTP=GLOB(0x55f2e33df4e0)<<< 250-PIPELINING
Net::SMTP=GLOB(0x55f2e33df4e0)<<< 250-DSN
Net::SMTP=GLOB(0x55f2e33df4e0)<<< 250-ENHANCEDSTATUSCODES
Net::SMTP=GLOB(0x55f2e33df4e0)<<< 250-STARTTLS
Net::SMTP=GLOB(0x55f2e33df4e0)<<< 250-8BITMIME
Net::SMTP=GLOB(0x55f2e33df4e0)<<< 250-BINARYMIME
Net::SMTP=GLOB(0x55f2e33df4e0)<<< 250-CHUNKING
Net::SMTP=GLOB(0x55f2e33df4e0)<<< 250 SMTPUTF8
Net::SMTP=GLOB(0x55f2e33df4e0)>>> STARTTLS
Net::SMTP=GLOB(0x55f2e33df4e0)<<< 220 2.0.0 SMTP server ready
Net::SMTP::_SSL=GLOB(0x55f2e33df4e0)>>> EHLO siliconsignals.io
Net::SMTP::_SSL=GLOB(0x55f2e33df4e0)<<< 250-BM1PR01CA0158.outlook.office365.com Hello [122.170.105.202]
Net::SMTP::_SSL=GLOB(0x55f2e33df4e0)<<< 250-SIZE 157286400
Net::SMTP::_SSL=GLOB(0x55f2e33df4e0)<<< 250-PIPELINING
Net::SMTP::_SSL=GLOB(0x55f2e33df4e0)<<< 250-DSN
Net::SMTP::_SSL=GLOB(0x55f2e33df4e0)<<< 250-ENHANCEDSTATUSCODES
Net::SMTP::_SSL=GLOB(0x55f2e33df4e0)<<< 250-AUTH LOGIN XOAUTH2
Net::SMTP::_SSL=GLOB(0x55f2e33df4e0)<<< 250-8BITMIME
Net::SMTP::_SSL=GLOB(0x55f2e33df4e0)<<< 250-BINARYMIME
Net::SMTP::_SSL=GLOB(0x55f2e33df4e0)<<< 250-CHUNKING
Net::SMTP::_SSL=GLOB(0x55f2e33df4e0)<<< 250 SMTPUTF8
Net::SMTP::_SSL=GLOB(0x55f2e33df4e0)>>> EHLO siliconsignals.io
Net::SMTP::_SSL=GLOB(0x55f2e33df4e0)<<< 250-BM1PR01CA0158.outlook.office365.com Hello [122.170.105.202]
Net::SMTP::_SSL=GLOB(0x55f2e33df4e0)<<< 250-SIZE 157286400
Net::SMTP::_SSL=GLOB(0x55f2e33df4e0)<<< 250-PIPELINING
Net::SMTP::_SSL=GLOB(0x55f2e33df4e0)<<< 250-DSN
Net::SMTP::_SSL=GLOB(0x55f2e33df4e0)<<< 250-ENHANCEDSTATUSCODES
Net::SMTP::_SSL=GLOB(0x55f2e33df4e0)<<< 250-AUTH LOGIN XOAUTH2
Net::SMTP::_SSL=GLOB(0x55f2e33df4e0)<<< 250-8BITMIME
Net::SMTP::_SSL=GLOB(0x55f2e33df4e0)<<< 250-BINARYMIME
Net::SMTP::_SSL=GLOB(0x55f2e33df4e0)<<< 250-CHUNKING
Net::SMTP::_SSL=GLOB(0x55f2e33df4e0)<<< 250 SMTPUTF8
Password for 'smtp://[email protected]@smtp-legacy.office365.com:587':
Net::SMTP::_SSL=GLOB(0x55f2e33df4e0)>>> AUTH LOGIN
Net::SMTP::_SSL=GLOB(0x55f2e33df4e0)<<< 334 *********
Net::SMTP::_SSL=GLOB(0x55f2e33df4e0)<<< (decoded) Username:
Net::SMTP::_SSL=GLOB(0x55f2e33df4e0)>>> (decoded) [email protected]
Net::SMTP::_SSL=GLOB(0x55f2e33df4e0)>>> dmlzaGFsc2luaC5wYXJtYXJAc2lsaWNvbnNpZ25hbHMuaW8=
Net::SMTP::_SSL=GLOB(0x55f2e33df4e0)<<< 334 *********
Net::SMTP::_SSL=GLOB(0x55f2e33df4e0)<<< (decoded) Password:
Net::SMTP::_SSL=GLOB(0x55f2e33df4e0)>>> (decoded) *********
Net::SMTP::_SSL=GLOB(0x55f2e33df4e0)>>> U2hpdmE0dmlzaCM=
Net::SMTP::_SSL=GLOB(0x55f2e33df4e0)<<< 535 5.7.139 Authentication unsuccessful, SmtpClientAuthentication is disabled for the Tenant. Visit https://aka.ms/smtp_auth_disabled for more information. [BM1PR01CA0158.INDPRD01.PROD.OUTLOOK.COM 2023-01-31T10:19:02.295Z 08DB03199EF82C8E]
5.7.139 Authentication unsuccessful, SmtpClientAuthentication is disabled for the Tenant. Visit https://aka.ms/smtp_auth_disabled for more information. [BM1PR01CA0158.INDPRD01.PROD.OUTLOOK.COM 2023-01-31T10:19:02.295Z 08DB03199EF82C8E]
没有调试日志:
$ git send-email [email protected] outgoing/*
outgoing/0001-biuld-bootloader-host-in-AI-100-so-it-will-work-out-.patch
(mbox) Adding cc: vishalsinh_sisignals <[email protected]> from line 'From: vishalsinh_sisignals <[email protected]>'
From: vishalsinh <[email protected]>
To: [email protected]
Cc: vishalsinh_sisignals <[email protected]>
Subject: [PATCH] biuld bootloader host in AI-100 so it will work out of box
Date: Tue, 31 Jan 2023 15:53:39 +0530
Message-Id: <[email protected]>
X-Mailer: git-send-email 2.34.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Send this email? ([y]es|[n]o|[e]dit|[q]uit|[a]ll): y
Password for 'smtp://[email protected]@smtp-legacy.office365.com:587':
5.7.139 Authentication unsuccessful, SmtpClientAuthentication is disabled for the Tenant. Visit https://aka.ms/smtp_auth_disabled for more information. [BMXPR01CA0089.INDPRD01.PROD.OUTLOOK.COM 2023-01-31T10:24:01.016Z 08DB03117D6EB381]
现在从 5.7.139 错误开始提供的链接提供 + 此类似错误链接我发现剩下的唯一问题是我的默认 Outlook 服务器安全默认设置为“SMTP AUTH”。管理员需要启用它,但由于我不是管理员。我将在这里停止并使用个人 Gmail。
答案1
达到 SMTP-AUTH 5.7.139 错误后,如编辑的问题所示。我停止了,因为我没有管理员权限来启用它。
所以我按照这个指南使用 gmail 进行了替代设置“git send-email”
- Gmail 设置,通过其他电子邮件平台检查 Gmail
- git 发送电子邮件初始设置
- 解决双因素身份验证问题。gmail 使用应用程序密码登录
答案2
改成smtpencryption = STARTTLS
smtpencryption = tls