linux git 发邮件,在Linux中无法使用git send-email发送源代码和补丁

我在本地创建了一个目录:/ home / Tegra.

我在/ home / Tegra中创建了以下文件:

hello_world.c hello_world_1.c hello_world_2.c

每个文件都是逐步修改的.我还创建了补丁:

diff -u hello_world.c hello_world_1.c > hello_world_1.patch

diff -u hello_world_1.c hello_world_2.c > hello_world_2.patch

>现在我想首先使用git [email protected]��应包含hello_world.c文件

>然后我想发送第二封电子邮件,其中包含hello_world_1.patch文件作为附件.

>然后我想发送第三封电子邮件,其中包含hello_world_2.patch文件作为附件.

不幸的是,我甚至无法完成第1步:

我的git已经正确配置了相关的smtp服务器tls 587端口.

我尝试了以下命令:

git send-email --to [email protected] --subject My Hello hello_world.c

我收到以下错误:

Cannot run git format-patch from outside a repository

存储库在哪里出现.我应该首先维护我的代码库.

编辑:对于第1步:根据下面的评论,我们需要一个存储库:

>在Github上创建了一个空存储库:“MyRepo”

>在本地计算机上克隆它. (使用git clone)

>然后将第一个文件“hello_world.c”添加到Directory / MyRepo中.

>然后>> git add hello_world.c

>然后>> git commit -m’我的第一个来源’

>然后>> git push -u origin master

>之后,我输入:git send-email –to = [email protected] –subject =“[asdasdas] assd asdasd”hello_world.c

现在我收到一个错误:

No subject line in hello_world.c ? at /usr/lib/git-core/git-send-email line 584

Then added the first file “hello_world.c” into the Directory /MyRepo”.

首先确保您已经在克隆的空仓库中实际提交了任何内容.

git add .

git commit -m "new commit"

git push

其次,git send-email doc确实提到:

--subject=

Specify the initial subject of the email thread. Only necessary if --compose is also set.

一定要使用–compose.

This format expects the first line of the file to contain the “Cc:” value and the “Subject:” of the message as the second line.

这适用于.patch,而不是源本身.

有关更完整的示例,请参见git format-patch和“How to send patches with git-send-email”:

对于最后一次提交:

git send-email -1 [email protected] --subject="[asdasdas] assd asdasd"

第三,一个更简单的解决方案是use git bundle.这会生成一个文件,你可以按照你想要的任何方式发送,接收者可以从中拉出/克隆.它(作为一个文件)作为一个简单的git repo.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值