[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