First of all, I am on macOS.
This warning is encountered by many users:
In conclusion, the solutions are to use system git or change the git template directory to
I have no problem in cloning my source code (it is just warning and do not block me from cloning). In many times, I just ignored it and finally this warning bites me hard.
I notice that my pre-commit hooks (setup by husky) are not running in my js project. After long time debugging, I find that .git/hooks is missing. And after several trial-and-errors, I find that when cloning via SourceTree, .git/hooks is not being created and it is due to the missing template warning!
By default, the template directory contains hooks, description and info directories. These will be copied to project directory during `git init` or `git clone`. But as template is not found by SourceTree, they are not copied!
It looks like SourceTree assumes template directory is /usr/local/git/share/git-core/templates which is not the case as documented in https://git-scm.com/docs/git-init#_template_directory
Can anyone take a look on this aged problem? It is affecting my team's workflow and obviously asking every team members to set SourceTree config is not one of the best solution.
I found that the issues was that the .gitconfig file in my home directory wasn't pointing to the location of the templates directory. If you open the .gigconfig file there will be a templatedir property in the intit section
templatedir = some_wrong_path/share/git-core/templates
If you can figure out where the templates actually, probably under one of the sourcetree or git folders, you can change the path. One thing I noticed is that the git version I was using wanted to add its git bath so I just needed.
templatedir = /share/git-core/templates
Have you tried switching to System Git in Sourcetree? If your setup works on terminal and everything is setup with the system git path, you should switch to using System Git. Navigate to Preference window's Git tab and click on Use System Git button to switch.
Yes I tried, and it worked (i.e. my hooks directory got created).
What I don't understand is why the embedded git is looking for git template at /usr/local/git/share/git-core/templates (I got this from the warning message in SourceTree) rather than the one documented at https://git-scm.com/docs/git-init#_template_directory
The default template dir is /usr/share/git-core/templates. If git is installed locally, I guess it should be /usr/local/share/git-core/templates.
Supported Platforms macOS Windows We recently introduced support for additional hosting services such as GitHub Enterprise, GitLab (Cloud, Community Edition, Enterprise Edition), and...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events