背景
使用 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