[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


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM