我收到此错误警告:当我在本地存储库中克隆 repo 时找不到模板 /usr/local/git/share/git-core/templates这个链接、这个链接和这个链接我试过这个方法,我只等了 20 多个分钟,但回购不克隆。我使用源树和 OS X El Capitan。我该如何解决?
8 回答
创建一个模板文件夹。
在你的情况下,它应该是:mkdir /usr/local/git/share/git-core/templates
我也收到同样的错误警告:当我在本地存储库中克隆 repo 时找不到模板 /usr/local/git/share/git-core/templates 然后我找到了解决我的问题的解决方案。我在主目录中的 .gitconfig 中添加了 [init] 部分,以便在克隆 repo 时查看 SourceTree 的 git 模板目录:
[init] templatedir = /Applications/SourceTree.app/Contents/Resources/git_local/share/git-core/templates
希望对你有帮助!。
如果是 macOS 上的源树步骤:
Source tree Menu
Preferences
Git
Click on System Git under Embedded Git Version 2.2.1
Reset to embedded Git
Restart source tree
与 Rohit 的回答类似,我进入 SourceTree 的 Tools->Options->Git 并选择“Update Embedded Git”。安装最新的 Embedded Git 版本后,警告停止发生。
通过 SourceTree for Mac 克隆,下载卡在 99%,我遇到了同样的错误:
警告:找不到模板 /usr/local/git/share/git-core/templates
我开始查找问题并找到了这个问题。正要从这里的一些答案开始......
但后来它终于完成了。所以,我的回答是:再等一会儿。我的克隆了10分钟左右。
我按照以下步骤操作,并且能够在 Windows 10 中解决此问题。
Step1: 首先在命令提示符下使用以下命令知道 %USERPROFILE% 的路径。
回显 %USERPROFILE%
请注意,您也可以运行git config --list并查找路径的 init.templatedir。
Step2: 在其中查找 .git_template 文件夹。如果缺少,请运行下面的命令来添加它。
git config --global init.templatedir "%USERPROFILE%.git_template
Step3: 在其中创建一个文件夹,即模板。
创建此模板文件夹后,我不再收到提到的警告,即“找不到模板”。
@wonderfulthunk 的评论对我有用:
sudo mkdir -p /usr/local/git/share/git-core/templates && sudo chown -R my_username /usr/local/git
就我而言,这是因为一个未访问的项目而发生的。检查您是否拥有克隆该存储库的所有权限。