1

I was trying to create a commit template, but when I do a commit I get this message

fatal: could not read 'templates/commit-template.txt': No such file or directory

I follow the next steps to create the commit template:

  • I create a new folder named templates, inside git folder
  • I create an archive commit-template.txt inside de folder templates

In gitbash I typed the following:

$ git config --global commit.template templates/commit-template.txt

I reviewed the config and I saw this, it seems ok :(

commit.template=templates/commit-template.txt
core.repositoryformatversion=0

But when I have tried to do a commit I received the message I wrote before (fatal: could not read 'templates/commit-template.txt': No such file or directory)

I have read about commit template in a book and I followed the instrucción, but I don´t know what am I doing wrong. I found some informaticon on the links below(and other more), but I am still lost. Could someone help me please.

Custom Git Commit Message Template

https://git-scm.com/docs/git-config

https://thoughtbot.com/blog/5-useful-tips-for-a-better-commit-message

Schwern
  • 153,029
  • 25
  • 195
  • 336
Sargentogato
  • 85
  • 1
  • 2
  • 9
  • It's relative to the repository root, not the .git directory. If you put it in `.git` you need `git config --global commit.template .git/templates/commit-template.txt`. – Schwern Jan 29 '20 at 20:05
  • @Schwern thank you very much. I don't know why I couldn't figure out something simple, the only I had to write was to full path of my commit-template.txt I feel fool – – Sargentogato Jan 29 '20 at 21:31
  • We've all banged our heads against the wall on something like this. – Schwern Jan 29 '20 at 21:34

0 Answers0