尝试向本地git分支提交(commit)时,使用git commit
命令出现如下错误:
fatal: could not read '/Users/<username>/.stCommitMsg': No such file or directory
请注意,可以使用-m
开关进行提交(commit):
git commit -m "commit message"
但并非没有它:
git commit
尝试向本地git分支提交(commit)时,使用git commit
命令出现如下错误:
fatal: could not read '/Users/<username>/.stCommitMsg': No such file or directory
请注意,可以使用-m
开关进行提交(commit):
git commit -m "commit message"
但并非没有它:
git commit
git commit
命令时,Git会从配置变量commit.template
中读取信息以找到一个提交信息模板并将其加载到您的编辑器中,以便您编写您的提交信息。/Users/<username>/.stCommitMsg
,但该文件不存在。git config --get commit.template
请确认您的用户名是否正确。如果文件不存在,您可以使用以下命令创建:
touch /Users/<username>/.stCommitMsg
或者,您可以编辑~/.gitconfig
文件并删除commit.template
项:
[commit]
template = /Users/<username>/.stCommitMsg
Git正在尝试查找用户定义的git提交模板。您可以在 loc '/Users/<username>/.stCommitMsg
中创建一个空文件,或者修改您的~/.gitconfig
以删除模板覆盖。
.stCommitMsg
文件和配置设置来自 SourceTree。当我将我的.gitconfig
迁移到一个没有安装 Sourcetree 的新系统时,产生了这个错误。 - John Ellmore