git源码安装(linux)

2 篇文章 0 订阅

git


摘要:基于linux(centos6.9)的git源码编译安装。

问题提出

[hadoop@hadoop01 ~]$ git clone https://github.com/mobz/elasticsearch-head.git
-bash: git: command not found

公共工具

[hadoop@hadoop01 ~]$ sudo yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel

下载

[hadoop@hadoop01 ~]$ wget http://www.codemonkey.org.uk/projects/git-snapshots/git/git-latest.tar.xz

解压

[hadoop@hadoop01 ~]$ xz -d git-latest.tar.xz 
[hadoop@hadoop01 ~]$ tar -xvf git-latest.tar

编译安装

[hadoop@hadoop01 git-2017-09-19]$ cd git-2017-09-19/
[hadoop@hadoop01 git-2017-09-19]$ autoconf
[hadoop@hadoop01 git-2017-09-19]$ ./configure --prefix=/usr/local/git 
[hadoop@hadoop01 git-2017-09-19]$ make
[hadoop@hadoop01 git-2017-09-19]$sudo make  install

配置系统环境

[root@hadoop01 bin]# vim /etc/profile
export GIT_HOME=/usr/local/git
export PATH=${GIT_HOME}/bin:${PATH}
[root@hadoop01 bin]# source /etc/profile

测试

[root@hadoop01 ~]# git --version
git version 2.14.GIT

完成

[root@hadoop01 ~]# git https://github.com/mobz/elasticsearch-head.git
git: 'https://github.com/mobz/elasticsearch-head.git' is not a git command. See 'git --help'.
[root@hadoop01 ~]# git clone https://github.com/mobz/elasticsearch-head.git
Cloning into 'elasticsearch-head'...
remote: Counting objects: 4224, done.
remote: Compressing objects: 100% (96/96), done.
remote: Total 4224 (delta 82), reused 97 (delta 43), pack-reused 4085
Receiving objects: 100% (4224/4224), 2.19 MiB | 139.00 KiB/s, done.
Resolving deltas: 100% (2316/2316), done.

不编译安装
[hadoop@hadoop02 ~]$ sudo yum install git

来自官网的方法

Download for Linux and Unix
It is easiest to install Git on Linux using the preferred package manager of your Linux distribution. If you prefer to build from source, you can find the tarballs on kernel.org.

Debian/Ubuntu
# apt-get install git
Fedora
# yum install git (up to Fedora 21)
# dnf install git (Fedora 22 and later)
Gentoo
# emerge --ask --verbose dev-vcs/git
Arch Linux
# pacman -S git
openSUSE
# zypper install git
Mageia
# urpmi git
FreeBSD
# pkg install git
Solaris 9/10/11 (OpenCSW)
# pkgutil -i git
Solaris 11 Express
# pkg install developer/versioning/git
OpenBSD
# pkg_add git
Alpine
$ apk add git
Red Hat Enterprise Linux, Oracle Linux, CentOS, Scientific Linux, et al.
RHEL and derivatives typically ship older versions of git. You can download a tarball and build from source, or use a 3rd-party repository such as the IUS Community Project to obtain a more recent version of git.

【作者:happyprince; http://blog.csdn.net/ld326/article/details/78034441

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值