为什么我的git没有从1.7.1更新到1.9.4

Var*_*run 6 git

我在REDHAT 6.我想更新我的git,我尝试了多种方法.

第一种方法

$ yum update git.我得到:没有标记为更新的包.

第二种方法

$ wget http://git-core.googlecode.com/files/git-1.8.3.4.tar.gz
$ wget -O git-manpages-1.8.3.4.tar.gz http://code.google.com/p/git-core/downloads/detail?name=git-manpages-1.8.3.4.tar.gz&can=2&q=

Next, install all required libraries before building GIT:

$ sudo yum install zlib-devel perl-CPAN gettext

Now let’s untar and build and install GIT in the /usr directory:

$ tar xvfz git-1.8.3.4.tar.gz
$ cd git-1.8.3.4
$ ./configure
$ make
$ sudo make prefix=/usr install
$ git --version
git version 1.8.3.4
Run Code Online (Sandbox Code Playgroud)

得到了这个错误.

[qaserver@qaserver3 ~]$ cd git-1.8.3.4
[qaserver@qaserver3 git-1.8.3.4]$ ./configure
configure: Setting lib to 'lib' (the default)
configure: Will try -pthread then -lpthread to enable POSIX Threads.
configure: CHECKS for site configuration
configure: CHECKS for programs
checking for cc... no
checking for gcc... no
configure: error: in `/home/qaserver/git-1.8.3.4':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
Run Code Online (Sandbox Code Playgroud)

第三种方法

安装必需的包

 # yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker
Run Code Online (Sandbox Code Playgroud)

下载并编译Git源代码

# cd /usr/src
# wget https://www.kernel.org/pub/software/scm/git/git-1.9.4.tar.gz
# tar xzf git-1.9.4.tar.gz
Run Code Online (Sandbox Code Playgroud)

下载并解压缩Git源代码后,使用以下命令编译源代码

# cd git-1.9.4
# make prefix=/usr/local/git all
# make prefix=/usr/local/git install
# echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/bashrc
# source /etc/bashrc
Run Code Online (Sandbox Code Playgroud)

所有上述命令都成功执行,没有任何错误,但是当我

$ git --version or $ git version
Run Code Online (Sandbox Code Playgroud)

我还是得到了.

git版本1.7.1

我生气了,这有什么问题,任何身体都有想法???

Eld*_*sis 7

对于RedHat或CentOS,方法3是正确的方法,只需要删除之前存在的git:

yum remove git
Run Code Online (Sandbox Code Playgroud)

之后,您的新git将按预期工作.

请参阅在CentOS/Redhat 7/6,5和Fedora 22/21上安装git.

我希望这有帮助.