1.问题描述
在使用repo管理代码后,在使用git commit命令进行提交时遇到报错
git: ‘interpret-trailers’ is not a git command. See ‘git --help’.
cannot insert change-id line in .git/COMMIT_EDITMSG
2.原因分析
报这个不错一般是由于git版本过旧,在ubuntu14.04下,默认的git版本是(1.9.1),所以需要更新git版本,下面一种安装git的方式(大部分的软件都可以通过这种方式安装)。
3.解决方法
1.首先移除git
sudo apt-get remove git
参考:Ubuntu apt-get彻底卸载软件包
2.下载新版本的源码进行编译安装
git镜像地址
# 下载方式:手动、wget
m@ubuntu:~$ wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.7.4.tar.gz --no-check-certificate
# 解压源码包
m@ubuntu:~$ tar -xzvf git-2.7.4.tar.gz
m@ubuntu:~$ cd git-2.7.4
# 配置源码编译选项
m@ubuntu:~/git-2.7.4$ ./configure prefix=/usr/
# 编译源码
m@ubuntu:~/git-2.7.4$ make prefix=/usr/local/git all
# #安装源码
m@ubuntu:~/git-2.7.4$ sudo make prefix=/usr/local/git install
# 将环境变量添加到PATH
m@ubuntu:~/git-2.7.4$ cd
m@ubuntu:~$ sudo vim /etc/profile
# 在最后加上以下内容
export PATH="/usr/local/git/bin:$PATH"
m@ubuntu:~$ source /etc/profile
添加环境变量参考:ubuntu添加环境变量的四种方法