解决Windows版Git(SourceTree)出现templates not found的问题

问题:

今天在用SourceTree clone imsdroid的源码时,出现一个警告信息

warning: templates not found
C:\Users\baope\AppData\Local\Atlassian\SourceTree\git_local\share\git-core\templates

于是想办法解决一下。

环境&解释:

  • Win 10
  • SourceTree 1.10.20.1(使用的SourceTree内嵌Git,而非系统安装Git)
  • SourceTree安装目录为
    C:\Users\baope\AppData\Local\Atlassian\SourceTree
  • SourceTree内置Git安装目录为
    C:\Users\baope\AppData\Local\Atlassian\SourceTree\git_local

分析:

看提示是没有找到tamplate文件。按照错误提示中的路径去找,确实没有对应的目录。我的Git安装目录下只有这些文件夹
SourceTree内置Git文件目录

原因找到了:原来SourceTree去了一个错误的位置找template文件,当然找不到了。我们把正确的位置告诉它就好了。

解决办法

1.在SourceTree的设置页面找遍了也没找到设置template的地方。于是想办法直接修改配置文件。
2. 由于SourceTree是调用了Git,于是我们去修改Git的配置文件。
3. 在WIn7系统,Git的配置文件位于C:\Users\<登录用户名>.gitconfig。使用文本编辑工具打开并加入如下几行:

[init]
templatedir=C:\Users\baope\AppData\Local\Atlassian\SourceTree\git_local\mingw32\share\git-core\templates

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

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

参考资料:

http://blog.csdn.net/sunux_sunux/article/details/52944807
https://answers.atlassian.com/questions/250260/about-git-path-for-sourcetree

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值