问题描述
我正在阅读有关git的教程,我的下一个任务是使用"git commit"命令并使用编辑器制作我的提交消息.我可以启动编辑器,但总是收到由于空消息错误而中止提交".我查看了我如何使Git使用我选择的编辑器进行提交?和中止提交由于提交消息为空,其他选项均不起作用. --wait无效,-multiInst和-notabbar参数无济于事.同样,当我将代码放入C:\ Users \ Kendall.gitconfig时,git仍然使用我从命令行在核心编辑器中输入的值.我试图在我的.gitconfig文件中使用-F标志,但是它没有任何作用,因为它仍然使用命令行中的值.任何帮助将不胜感激.
I am going through a tutorial on git and my next task is to use a "git commit" command and use an editor to make my commit message. I can get the editor to come up but I always get the "Aborting commit due to empty message error." I looked at How do I make Git use the editor of my choice for commits? and Aborting commit due to empty commit message among other places and none of the options work. The --wait isn't legal and the -multiInst and -notabbar arguments didn't help. Also when I put the code in my C:\Users\Kendall.gitconfig git still uses the value I put in the core editor from the command line. I tried to use the -F flag in my .gitconfig file but it had no effect because it still used the value from the command line. Any help would be appreciated.
推荐答案
您没有在编辑器中保存文件,因此,当git尝试读取临时文件时,看不到任何提交消息.
You are not saving the file in the editor therefore when git tries to read the temp file it sees no commit message.
对于初学者而言,最简单的方法是使用-m标志并将您的消息作为字符串括在引号中.
The easiest thing for beginners is to use the -m flag and pass your message as a string in quotes.
git commit -m "commit message here"
这篇关于由于空消息而中止提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!