[SourceTree] - 使用内置 Git 克隆项目出现 templates not found 问题之解决

背景

使用 SourceTree 克隆 Asp.Net Core 项目失败。

错误

warning: templates not found C:\Program Files\Git\share\git-core\templates.

原因

SourceTree 寻找 template 文件的路径不对,正确路径应该为 C:\Program Files\Git\mingw64\share\git-core\templates

解决

1. 在 SourceTree 的设置选项中没找到设置 template 的地方,于是想办法直接修改配置文件。

2. 由于SourceTree是调用了内置 Git,于是我们去修改 Git 的配置文件。

3. 在WIn10系统中,Git 的配置文件位于 C:\Users\<登录用户名>\.gitconfig 。使用文本编辑工具打开并加入如下几行:

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

注意:路径中的"\"要用"/"代替,不然会报错。

保存并重启SourceTree,问题解决。

参考资料

https://blog.csdn.net/sunux_sunux/article/details/52944807

posted @ 2018-03-25 22:25  jinzesudawei  阅读(5362)  评论(0编辑  收藏  举报