Gab*_*les 26 git git-send-email
如何配置git send-email才能使用 Gmail?
我想为glibc(GNU C 库,不要与GNOME 的 GLib库混淆)做出贡献,例如,更新glibc/benchtests/bench-malloc-thread.cmalloc 速度测试基准测试,但它们已经过时且过时,并且仍然生活在我们拥有的黑暗时代在命令行通过电子邮件提交补丁,而不是通过 GitHub 或 GitLab 打开 Pull 请求。:)
请参阅glibc此处的贡献说明: https: //sourceware.org/glibc/wiki/Contribution%20checklist:
- 使用以下命令创建一个或多个补丁
git format-patch- 用于
git send-email --to=libc-alpha@sourceware.org将补丁发送到列表,--cc如果需要,用于引起特定维护人员的注意。- 如果您的补丁尚未经过审核,至少每周执行一次 Ping 操作
我尝试阅读和关注大量资源,但似乎没有一个是完整的,即:
git send-email注意:为了贡献补丁,您需要使用的另一个项目是Buildroot(请参见此处:https: //buildroot.org/downloads/manual/manual.html#submitting-patches),它用于构建自定义嵌入式Linux 发行版。因此,如果也想为 Buildroot 解决这个问题,请参阅我的答案。
Gab*_*les 64
glibc、Buildroot和其他需要使用 来发送补丁的项目的开发人员和维护人员请注意git send-email:如果我不是专业开发人员,我根本没有机会提交补丁,即使我知道如何熟练地提交补丁代码并需要进行重要更改。进入git、变基、格式化补丁、配置git send-email等的门槛太高了。考虑使用GitHub、GitLab或BitBucket等现代工具来管理您的项目并接受补丁,以代替通过电子邮件发送的补丁、电子邮件邮件列表和git send-email. 最近实现这一转变的一个巨大成功案例是KiCad。2020 年,他们仍在使用通过电子邮件发送的 git 补丁。现在,他们已完全迁移到 GitLab: https: //gitlab.com/kicad。例如,他们的问题报告和管理现在变得非常容易!:https://gitlab.com/kicad/code/kicad/-/issues。即使是非程序员的普通用户现在也可以轻松报告问题,而之前 KiCad 使用https://launchpad.net/kicad,这更加繁琐和困难。
至少,请帮人们一个忙,请引导人们找到此答案以帮助他们设置git send-email,并帮助保持此答案为最新。
git send-emailGmail经过大量的努力,并使用问题底部的所有资源,我能够从所有来源的组合中拼凑出一个解决方案。耐心听我说。
在 Ubuntu 20.04 上测试。
安装git send-email:
sudo apt update
sudo apt install git-email
Run Code Online (Sandbox Code Playgroud)
来源:git:'send-email' 不是 git 命令。请参阅“git --help” 如果没有上述安装,您将看到:
Run Code Online (Sandbox Code Playgroud)git: 'send-email' is not a git command. See 'git --help'.
安装 Perl 脚本依赖项(Perl 必须已安装):
git: 'send-email' is not a git command. See 'git --help'.
Run Code Online (Sandbox Code Playgroud)
来源:https ://coderwall.com/p/qcsiew/setting-up-and-using-git-send-email-with-gmail
~/.gitconfig通过确保其中包含以下内容来配置您的文件:
cpan Authen::SASL MIME::Base64 Net::SMTP::SSL
Run Code Online (Sandbox Code Playgroud)
资料来源:很多地方,但唯一说要添加该[credential]部分(这非常重要)的是:https: //gist.github.com/winksaville/dd69a860d0d05298d1945ceff048ce46
将您的 Google 帐户配置为 1) 2 因素身份验证(以启用应用程序专用密码),以及 2) gmail 的应用程序专用密码,供以下用户使用git send-email:
选择“其他(自定义名称) ”作为设备:
git send-email,或类似的。单击“生成”按钮。它将弹出一个 16 位完全访问密码。把它写下来,中间不要有空格。这只是 16 个字符。如果需要,请将您想要作为补丁通过电子邮件发送的提交压缩为单个提交。挤压技术有多种,但以下是一种常见的方法:
[user]
name = First Last
email = my_email@gmail.com
[sendemail]
smtpServer = smtp.gmail.com
smtpServerPort = 587
smtpEncryption = tls
smtpUser = my_email@gmail.com
# (Optional: we'll leave this commented out and use a different way)
# smtpPass = PASSWORD
[credential]
helper = store
Run Code Online (Sandbox Code Playgroud)
有关其他挤压技术,请参阅我的个人笔记文档、git 和 Linux cmds、帮助、提示和技巧 - Gabriel.txt,位于我的eRCaGuy_dotfiles 存储库中。在该文件中搜索以下短语:
== TWO WAYS TO SQUASH ==CONCISE SQUASH SUMMARYMORE-DETAILED REBASE AND SQUASH NOTES为您最新的压缩提交创建补丁文件:
# Squash all commits from `my_first_commit` to `HEAD` (the latest commit),
# inclusive.
git rebase -i my_first_commit~ # do NOT forget the tilde (~) at the end!
# In the git editor that opens up, manually set the first entry to
# "pick", and set all others afterwards to "squash", or just "s" for short.
# Save, then close the editor and let it squash.
Run Code Online (Sandbox Code Playgroud)
这会生成一个补丁文件。例子:0001-bench-malloc-thread.c-add-assert-that-malloc-is-neve.patch。
通过电子邮件将该补丁文件发送到需要发送的位置。对于初始测试,我们只需通过电子邮件将其发送给您自己即可my_email@gmail.com。
git format-patch -1 HEAD
Run Code Online (Sandbox Code Playgroud)
将显示有关电子邮件的信息,最后将显示以下内容:
Run Code Online (Sandbox Code Playgroud)Send this email? ([y]es|[n]o|[e]dit|[q]uit|[a]ll):
键入y并按Enter发送消息。当您第一次使用它发送电子邮件时,git send-email系统会提示您输入密码。使用您为上面的 Google 帐户生成的应用专用密码,系统就会发送电子邮件。
由于您已将条目添加[credential] helper = store到~/.gitconfig上面的文件中,git 现在会自动将您的应用程序特定密码存储在名为 .gitignore 的新文件中以供将来使用~/.git-credentials。如果您打开该文件,您将看到一个 URL 字符串,其中以纯文本形式嵌入了您的密码。它看起来像这样:
git send-email --to=my_email@gmail.com 0001-bench-malloc-thread.c-add-assert-that-malloc-is-neve.patch
Run Code Online (Sandbox Code Playgroud)
其中EMAIL是您的电子邮件地址的第一部分(符号之前@),以及16-DIGIT-PASSWORD您之前为 Google 帐户生成的 16 位应用专用密码(如上)。
希望你的硬盘是加密的(你第一次安装 Ubuntu 时应该选择 LUKS 加密,以实现全盘加密),并且你是计算机上唯一的 root 用户。如果是这种情况,这不是安全问题,因为ll ~/.git-credentialsshows -rw------- 1 your_username your_groupname,这意味着除了您之外的任何人都无法读取该文件。
完毕!下次运行时git send-email,您将不必输入应用程序密码,因为它现在保存在~/.git-credentials.
| 归档时间: |
|
| 查看次数: |
10549 次 |
| 最近记录: |