About git path for Sourcetree

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

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.

It works after I switchted to 'System Git' .  

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

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. 

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

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

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.

Thanks! This worked for me too!

If it is Windows, try it with

[init]

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

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.

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

Hey Norlan,

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

Thanks!

/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

Is sourcetree configured to use embedded or system git?

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.

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

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).

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

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.

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 Feb 05, 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
patman I'm New Here Mar 07, 2018

thank you!

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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Thursday in Off-topic

Friday Fun: Magic Eyes

...staring into the background. Once the image pops out in 3D, you can look around the picture and enjoy. If you will see if you are a true illusion master! :) You did it? :) Wow! Awesome! As a bonus...

410 views 79 11
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you