如何调试" git send-email"失败的问题?

时间:2015-08-19 03:47:52

标签: git email smtp sendmail

我想使用git send-email发送补丁。 .gitconfig文件是这样的:

[user]
        name = Nan Xiao
        email = xxxxxx@chinadtrace.org
[sendemail]
        smtpencryption = ssl
        smtpserver = mail.chinadtrace.org
        smtpuser = xxxxxx@chinadtrace.org
        smtpserverport = 465
        smtppass = xxxxxxxxxx

git send-email命令的输出如下:

[root@localhost linux]# git send-email --smtp-debug --to xxxxxx@gmail.com 0001-xxxxxx.patch

......

Send this email? ([y]es|[n]o|[q]uit|[a]ll): y
Unable to initialize SMTP properly. Check config and use --smtp-debug. VALUES: server=mail.chinadtrace.org encryption=ssl hello=localhost.localdomain port=465 at /usr/libexec/git-core/git-send-email line 1308.

tcpdump捕获数据包喜欢这样:

tcpdump: listening on enp0s3, link-type EN10MB (Ethernet), capture size 262144 bytes
01:45:15.201553 IP (tos 0x0, ttl 64, id 29480, offset 0, flags [DF], proto TCP (6), length 60)
    localhost.localdomain.38225 > cp-41.webhostbox.net.urd: Flags [S], cksum 0xecfd (incorrect -> 0x21a6), seq 2849543224, win 29200, options [mss 1460,sackOK,TS val 188147472 ecr 0,nop,wscale 7], length 0
01:45:16.204505 IP (tos 0x0, ttl 64, id 29481, offset 0, flags [DF], proto TCP (6), length 60)
    localhost.localdomain.38225 > cp-41.webhostbox.net.urd: Flags [S], cksum 0xecfd (incorrect -> 0x1dba), seq 2849543224, win 29200, options [mss 1460,sackOK,TS val 188148476 ecr 0,nop,wscale 7], length 0

虽然我添加了" --smtp-debug"选项,我仍然无法分析根本原因。谁能提供一些线索?

更新
我发现原因是我的服务器使用了代理,但是如何让git send-email使用此代理呢?

1 个答案:

答案 0 :(得分:0)

  • 在发送电子邮件git format-patch HEAD~..HEAD
  • 之前,是否有格式修补程序
  • 在终端git send-email 0001-my-commit-name-generated.patch
  • 中运行此命令
  • 对我来说有用的是我们有一个自签名证书,这就是我在~/.gitconfig(全局git配置)中使用的证书。尝试从本地机器提供ssl证书路径,每个Debian都有一个。

    [sendemail]
      from = Dani Carvahal <dani.carvahal@example.com>
      smtpserver = mail02.buc.example.org
      smtpuser = dani.carvahal@example.com
      smtpencryption = tls
      smtpsslcertpath = /usr/local/share/ca-certificates/example-cacert.pem
      smtppass = justmyemailpassword
      chainreplyto = false
      smtpserverport = 25
      to = Bob Smith <bob.smith@example.com>
      bcc = Dani Carvahal <dani.carvahal@example.com>