警告:找不到模板 /usr/local/git/share/git-core/templates

warning: templates not found /usr/local/git/share/git-core/templates

我收到此错误 警告:找不到模板 /usr/local/git/share/git-core/templates 当我在本地存储库中克隆 repo this link, this link, and this link 我尝试了此方法,我只是在等待更多超过 20 分钟,但 repo 没有克隆。我使用 source-tree 和 OS X El Capitan。我该如何解决?

创建模板文件夹。

在你的情况下,它应该是:mkdir /usr/local/git/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

我也遇到了同样的错误 警告:找不到模板 /usr/local/git/share/git-core/templates 当我在本地存储库中克隆存储库时,我找到了解决我的问题的解决方案。 我将 [init] 部分添加到主目录中的 .gitconfig 中,以便它在克隆 repo 时查看 SourceTree 的 git 模板目录:

[初始化] templatedir = /Applications/SourceTree.app/Contents/Resources/git_local/share/git-core/templates

希望对您有所帮助!

与Rohit的回答类似,我进入SourceTree的工具->选项->Git并选择"Update Embedded Git"。安装最新的嵌入式 Git 版本后,警告停止出现。

@wonderfulthunk 的评论对我有用:

sudo mkdir -p /usr/local/git/share/git-core/templates && sudo chown -R my_username /usr/local/git

通过 SourceTree 克隆 Mac,下载停滞在 99%,我遇到了同样的错误:

warning: templates not found /usr/local/git/share/git-core/templates

我开始查找问题并找到了这个问题。正要从这里的一些答案开始...

但后来终于完成了。所以,我的回答是:再等等。我的克隆了 10 分钟左右。

就我而言,这是因为一个未访问的项目。检查您是否拥有克隆该存储库的所有权限。

我按照以下步骤操作,我能够在 Windows 10.

中解决这个问题

第一步: 首先在命令提示符下使用以下命令了解 %USERPROFILE% 的路径。

echo %USERPROFILE%

请注意,您还可以 运行 git config --list 并查找 init.templatedir 作为路径。

第二步: 在其中查找 .git_template 文件夹。 如有遗漏,请运行下方命令添加

git config --global init.templatedir "%USERPROFILE%.git_template

第三步: 在里面新建一个文件夹templates

创建此模板文件夹后,我没有收到提到的警告,即 'templates not found'。