Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

About git path for Sourcetree

Norlan He January 12, 2014

Hi,

I got a problem when I want to clone a repository from bitbucket using sourceTree in MAC OS. It seems sourcetree default my git PATH in /usr/local/git while my git is exactly installed somewhere else(installed with brew) which makes the warning below when cloning and the cloning can't be finished.

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

How could I fix this problem! Much thanks!

6 answers

1 accepted

21 votes
Answer accepted
Zachary Segal
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 11, 2015

I had the same "Template not found" error with a fresh installation of SourceTree 2.0.5.2 in Yosemite 10.10.3 with Xcode 6.3.1 installed. To investigate the problem I opened the SourceTree Preferences and went to the Git Preferences Panel. There the panel was reporting that I was using the embedded version, I switched to "System Git" and then switched back to "Embedded Git", and it fixed the problem.

 

Seems like there may be a glitch in SourceTree, I hope my findings helps anyone who is having the same problem.

hezll
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 11, 2016

It works after I switchted to 'System Git' .  

alough I downloaded and installed git from https://git-scm.com/downloads

Like # people like this
Ares
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 11, 2017

I can confirm this is a problem with the embedded git version (v2.8.1). Switching to System Git (v2.10.1) fixed the problem. 

Todd Smith
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 15, 2018

When I had this problem I was l already using system git, but switching to the embedded one fixed it.

9 votes
bdimaggio
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 16, 2014

This was bugging me for ages, although it didn't seem to affect the speed with which I could clone repos. Anyway, I fixed it by adding the [init] section to .gitconfig in my 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

thinsoldier
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 2, 2015

This seems to have worked. I still can't clone a submodule from Bitbucket due to a different error involving passwords. But the templates portion of the error went away thanks to this.

Pratik Shah
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 10, 2016

Thanks! This worked for me too!

Ramanathan Valliyappa
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 22, 2016

If it is Windows, try it with

[init]

    templatedir = C:/Program Files/Git/mingw64/share/git-core/templates

Like Jicy_Ann_Thomas likes this
Weifu Yu
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 12, 2017

or

templatedir = C:/Users/[name]/AppData/Local/Programs/Git/mingw64/share/git-core/templates

Depends on where the git is. It's strange the git is in different places with default installation.

4 votes
Mathew
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 21, 2015

Thank you Segal, your workaround was perfectly worked for me.

With Xcode 6.3.1, Source tree 2.0.5.2 and Yosemite 10.10.3

Thank you for posting this.

Steps:

  • Source tree Menu
  • Preferences
  • Git
  • Click on System Git under Embedded Git Version 2.2.1
  • Reset to embedded Git
2 votes
KieranA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 12, 2014

Hey Norlan,

What happens when you type in "which git" at the terminal?

Thanks!

Norlan He January 12, 2014

/usr/local/homebrew/bin/git

this should be a soft link organized by the brew,the actual home path of the git should be /usr/local/homebrew/Cellar/git/1.8.5.2 where I can find the share/git-core/templates

Seth
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 12, 2014

Is sourcetree configured to use embedded or system git?

Norlan He January 13, 2014

Thanks for helping! It's just a stupid mistake. Sourcetree can works normally through this warning, but I need to wait for nearly an hour to finish the cloning for the project is too large. Embarrassing.

KieranA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 13, 2014

Sorry Norlan, I'm being silly. SourceTree runs in its own environment entirely. Whatever is on your PATH won't be used by SourceTree. I'm assuming based on what you've said that you're using system Git in SourceTree and have specified /usr/local/git as the Git path. Check it out by going to Preferences > Git and seeing what it says there.

Cheers

David Resnick
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 23, 2015

It would be helpful if the "accepted" answer here was an actual answer, instead of a series of questions and answers. If I understand correctly, there isn't an actual solution for the problem (a warning when running git actions in sourcetree).

Seth
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 24, 2015

@David Resnick Did any of the other answers work for you?

David Resnick
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 25, 2015

Since it's only a warning, I haven't done much further investigations. I did change the git used by sourcetree from internal to what I have installed on my machine (2.5) and I haven't seen any further warnings. BTW, I wanted to reply to you here yesterday but I couldn't because I didn't have enough karma points. This stackoverflow platform looks nice, but it looks like it isn't being used very well to help answer questions about the product (sourcetree). This is the first result when googling the warning output by sourcetree; it would have been great to find an actual answer here.

Chris Foster
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 17, 2016

I found away around it by using iTerm to clone the Repo. I suspect it has to do with the Size of the Repo and SourceTree not being able to cope.

1 vote
Mike Corsaro
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 5, 2018

Just to get this all in one post: if you're seeing this on Windows, do the following:

  • First, find and open your .gitconfig, which should be in: "C:\Users\USERNAME\.gitconfig"
  • Then, add the following, and do not wrap the path in single or double quotes:
  • If you're using System Git:
    • [init]
          templatedir = C:/Program Files/Git/mingw64/share/git-core/templates

       

  • If you're using Embedded Git:
    • [init]
          templatedir = C:/Users/USERNAME/AppData/Local/Atlassian/SourceTree/git_local/mingw32/share/git-core/templates

       

  • If done correctly, running "git config --global init.templatedir" should print the path you added above.
  • If the above did not print the directory you just added, run "git config --list --show-origin" and find the entry and path for "init.templatedir" -- which will let you know where git is loading the config value from
snowboard_pat
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 7, 2018

thank you!

Andres Lopera
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 22, 2018

It worked for me. Thanks.

0 votes
Simon Donaldson
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 4, 2015

This happened to me on a 1gig+ repo. Shame the progress bar doesn't show any activity in that time and it looks like it's hung

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events