且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Linux(centos7)安装Git

更新时间:2022-06-30 07:05:46

下载最新版git

1

# wget https://github.com/git/git/archive/v2.9.2.tar.gz

解压

1

2

# tar zxvf v2.9.2.tar.gz

# cd git-2.9.2

编译安装

1

2

3

4

# make configure

-bash: make: command not found的解决办法  

一般出现这个-bash: make: command not found提示,是因为安装系统的时候使用的是最小化mini安装,系统没有安装makevim等常用命令,直接yum安装下即可。

yum -y install gcc   automake autoconf libtool make

直接ssh运行即可,安装make

 

./configure   --prefix=/usr/java/git/git --with-iconv=/usr/java/git/libiconv

# make all doc

编译git时报错: zlib.h: No such file or directory

In file included from credential-store.c:1:
  cache.h:21:18: warning: zlib.h: No such file   or directory
  In file included from credential-store.c:1:
  cache.h:23: error: expected   specifier-qualifier-list before 
‘z_stream’
  make: *** [credential-store.o] Error 1

============================================================

 

缺少 zlib的头文件, 开发包没装,

yum install zlib (系统默认已经装上)

yum install zlib-devel 

解决

 

# sudo make install install-doc install-html

修改环境变量

1

# sudo vim /etc/profile

在最后一行添加

1

export PATH=/usr/java/git/git/bin:$PATH

保存后使其立即生效

1

# source /etc/profile

查看是否安装成功

1

#git --version

在pycharm中修改git指向

File->Settings->Version Control->Git->Path to Git executable:

选择/usr/local/git/bin/git

 


本文转自 顶风走千里 51CTO博客,原文链接:http://blog.51cto.com/13505030/2055095