47

I get this error warning: templates not found /usr/local/git/share/git-core/templates when I cloning repo in local repository this link, this link, and this link I tried this method and I just waiting more than 20 minutes but repo doesn't clone. I use source-tree and OS X El Capitan. How can I fix it?

Alexander Khitev
  • 6,417
  • 13
  • 59
  • 115

11 Answers11

51

Create a templates folder.

In your case, it should be: mkdir /usr/local/git/share/git-core/templates

dpaluy
  • 3,537
  • 1
  • 28
  • 42
  • 2
    I ran into the same error and tried this. But no use. – Ali Abbas Jaffri Jun 16 '16 at 17:01
  • 1
    you may have to also mkdir of the git folder, share folder etc – Pixelomo Jul 19 '16 at 09:21
  • 19
    Confirmed this worked for me (sudo mkdir -p /usr/local/git/share/git-core/templates && sudo chown -R _my_username_ /usr/local/git) - seems like sourcetree on OSX blindly checks this /usr/local templates path regardless of which git you have installed or which git sourcetree is otherwise successfully using. – wonderfulthunk Jul 07 '17 at 14:31
  • Couldn't use sudo in my machine, so I simply cloned it from git and imported it into sourcetree – htafoya Aug 16 '22 at 17:43
15

I was also getting same error warning: templates not found /usr/local/git/share/git-core/templates when I cloning repo in local repository then i found solution which solved my issue. I Added the [init] section to .gitconfig in home directory, so that it looked at SourceTree's git templates directory when cloning a repo:

[init] templatedir = /Applications/SourceTree.app/Contents/Resources/git_local/share/git-core/templates

Hope it will help you!.

Anand Halawai
  • 151
  • 1
  • 5
  • If I may add, and if you're on linux, type: ```whereis git-core``` This one-line command will give you the location/s of your git-core folder. – MsC Dec 18 '19 at 15:04
10

In case of Source tree on macOS Steps:

Source tree Menu
Preferences
Git
Click on System Git under Embedded Git Version 2.2.1
Reset to embedded Git
Restart source tree
Rohit Kanade
  • 137
  • 2
  • 14
  • This had no effect for me - seems like there is just a bug in sourcetree where it always points to the templates path of what would have been a "brew install" git, even if you haven't brew installed git. – wonderfulthunk Jul 07 '17 at 14:32
  • 1
    This actually worked for me on macOS 10.12 with SourceTree 2.6.2 -- and without needing to restart SourceTree. I switched to the System git, reinitiated the clone (which now ran without no template error), then switched back. Some old Atlassian [support forum posts](https://community.atlassian.com/t5/Git-questions/About-git-path-for-Sourcetree/qaq-p/186483) also describe this as working. – JeremyDouglass May 19 '18 at 04:11
  • This solution have no effect. – NaXir Dec 22 '18 at 14:33
4

Similar to Rohit's answer, I went into SourceTree's Tools->Options->Git and selected "Update Embedded Git". After the latest Embedded Git version was installed, the warning stopped occurring.

Bruce Calvert
  • 245
  • 4
  • 10
4

Cloning via SourceTree for Mac, the download was stuck at 99% and I was getting the same error:

warning: templates not found /usr/local/git/share/git-core/templates

I started looking up the issue and found this Question. Was about to start with some of the Answers here...

But then it finally completed. So, my Answer: wait a bit longer. Mine was cloning for 10 minutes or so.

pkamb
  • 33,281
  • 23
  • 160
  • 191
  • i'm getting same error and it took one hour still i can't clone @pkamb is there any other solution for this? – Sweta Vani Oct 29 '20 at 09:29
  • 1
    Absolutely, it may take some more mins, in my case as well, it took around 5-7 mins to get cloned completely. So, I'd recommend to wait for at least sometime for cloning. – Neeraj Shukla Apr 09 '21 at 07:31
  • Time didn't make any difference for me. I just clone via command line, then add the now local repo to Sourcetree. – Eric Soyke Aug 28 '22 at 20:10
3

@wonderfulthunk's comment works for me:

sudo mkdir -p /usr/local/git/share/git-core/templates && sudo chown -R my_username /usr/local/git
samthui7
  • 923
  • 2
  • 12
  • 11
2

I followed below steps and I am able to get through this issue in Windows 10.

Step1: First know the path of %USERPROFILE% using below command in command prompt.

echo %USERPROFILE%

Please note that, you can also run git config --list and look for init.templatedir for the path.

Step2: Look for .git_template folder in it. If is missing, please run below command to add it.

git config --global init.templatedir "%USERPROFILE%.git_template

Step3: Create a folder namely templates in it.

After creating this templates folder, I did not get the warning mentioned i.e. 'templates not found' any more.

1

MacOS: Ventura 13.0 / Sourcetree: 4.2.0

I fixed warning: templates not found /usr/local/git/share/git-core/templates by going to "Sourcetree preferences -> Git" and clicking to "Use System Git". There's no need to restart Sourcetree, just try to clone again. I didn't switch to usage of embedded Git again, all works perfectly with usage of System Git.

enter image description here

0

In my case, this happened because an unaccesed project. Check that you have all the privileges to clone that repository.

Hanako
  • 1,637
  • 1
  • 13
  • 16
0

If you use Sourcetree application, switch git version from "Embedded Git" to "System Git" in setting.

https://community.atlassian.com/t5/Bitbucket-questions/About-git-path-for-Sourcetree/qaq-p/186483

And after changing git version, if you still have problem with cloning, change protocol from "ssh" to "https".

sangeun jo
  • 37
  • 9
0

I couldn't get past this problem. Even after getting rid of the 'templates not found' error by adding the usr/local/git... folder, the clone would still look like it was at 99% and sit there for HOURS. I just clone via command line and it's there in seconds, then I just add the local repo to Sourcetree instead.

Eric Soyke
  • 1,073
  • 1
  • 15
  • 30