首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >安装git出现templates not found的问题

安装git出现templates not found的问题

作者头像
千往
发布2018-01-24 11:03:34
2.3K0
发布2018-01-24 11:03:34
举报

背景

goods.api需要在新机器上部署,该机器上没有安装git,需要安装git,查询git版本为2.4.5-1.el6 ,使用yum 一顿安装后,执行git clone命令告知warning: templates not found /usr/local/test-git/share/git-core/templates ,导致无法拉取代码下来

操作流程重现

1、执行 yum list | grep ^git  查看git版本

2、执行yum install git.x86_64 ,安装git

     图略

3、安装完毕后 ,去到相应的目录执行git clone xxxx.git ,提示warning: templates not found /usr/local/test-git/share/git-core/templates

解决思路

1、碰到问题先baidu+bing+google

    大概知道两种方案:一种指定安装路径重新安装一次git;第二方案,提示找不到templates,那就指定templates;采用第二方案,指定templates目录,资料(http://www.cnblogs.com/lucktian/p/6196877.html)显示需要指定templatedir这个变量,需要去到~/.gitconfig文件去设置

2、先获取已经安装git的templates目录

    执行rpm -ql git 查看安装路径

3、准备修改~/.gitconfig,添加templatedir的参数,结果发现没有~/.gitconfig文件,但是可以通过git config --global init.templatedir “/usr/share/git-core/templates”

    执行git config --global init.templatedir=/usr/share/git-core/templates 后发现竟然生成了.gitconfig文件,查看该文件

4、再执行git clone xxx.git 发现没有报错,可以正常拉取代码

思考

1、可能是因为之前安装了不同版本的git,没有卸载干净导致这个问题的;

2、查询的资料少的时候,结合已知信息多尝试;

3、config的设置是根据git config --global user.name "jwen" 联想过来的;

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2017-09-12 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 背景
  • 操作流程重现
  • 解决思路
  • 思考
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档