Search code examples
gitgit-commitgit-config

How can I undo commit template?


I once added global commit temlate by command:

git config --global commit.template .gitmessage.txt

Today I created my own repository and when I tried commit, I got error:

fatal: could not read '.gitmessage.txt': No such file or directory

It's fine, because I don't create .gitmessage.txt file. I wouldn't have a template for this repo. And here comes the question: How can I undo global commit template? I can overwrite global commit template but I can delete thi configuration.

I was trying:

git config --global commit.template ""

but i got similar error:

fatal: could not read '''': No such file or directory

And when I run command

git config --global commit.template

i got echo current template. Anyone can help me?


Solution

  • Remove this section from the ~/.gitconfig file on your system.

    [commit]
        template = .gitmessage.txt