最代码官方的gravatar头像
最代码官方 2014-08-20 17:39:41
如何在linux centos下安装git

今天想开通github的服务,于是在服务器上安装git,百度到的结果千篇一律的全都有错误,给大家总结分享下。

如果yum install git可以直接安装的可以不通过源码编译安装。

源码安装步骤如下

1.首先下载git源码

地址:http://codemonkey.org.uk/projects/git-snapshots/git/

比如地址:http://codemonkey.org.uk/projects/git-snapshots/git/git-2014-08-20.tar.xz

2.xz文件解压

xz -d git-2014-08-20.tar.xz

tar -xvf git-2014-08-20.tar

3.安装git

cd git-2014-08-20/

autoconf

./configure --prefix=/usr/local/git/

make

make install

如果make的时候报错:/bin/sh: msgfmt: command not found

则需要:

yum install gettext-devel

4.将git加到环境变量中

vim /etc/profile

export GIT_HOME=/usr/local/git/
export PATH=$PATH:$GIT_HOME/bin

这样就可以直接运行git命令了。

如何在linux centos下安装git

enjoy it

最后的成果:

http://zuidaima.github.io/

https://github.com/zuidaima/


打赏
最近浏览
hulewang  LV7 2020年5月27日
nhslailuo  LV2 2020年5月14日
myjaychou  LV3 2020年1月3日
scurry30  LV4 2019年12月28日
luohaipeng  LV23 2019年12月3日
13232875251  LV14 2019年11月21日
善待我 2019年11月20日
暂无贡献等级
yuannie 2019年7月30日
暂无贡献等级
cuihui123  LV6 2019年6月3日
小妖钙  LV10 2019年5月23日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友