这里记录了windows和centos的git安装过程:
首先到官网下载Git
一路”下一步“即可。
安装好之后,可以右键,会看到两个git选项:
1.Git Gui
2.Git Bush Here
下面接着安装lGit的使用工具"TortoiseGit"
接着完成安装
接着跟着向导
一路"下一步"
需要填写"用户名"和"邮箱"
点击完成
最后被安装在这里
接着回到桌面右键就可以看到工具了。
Liunx版git的安装
地址:
https://mirrors.edge.kernel.org/pub/software/scm/git/
需要下载 git-2.9.5.tar.gz 不要下错,还有xz结尾的包。
接着打开Centos7虚拟机
刚才得到的压缩包,可以通过共享文件夹共享到虚拟机,我的共享文件夹是share-0322。
在共享文件夹下查看文件,首先把它解压到当前的共享文件夹,命令如下:
tar -zxvf git-2.9.5.gz
然后把解压后的文件复制到虚拟机的/etc文件夹下,命令如下:
cp -rf git-2.9.5 /etc
下面就可以在/etc文件夹下进行安装,安装之前需要先看一下之前是否安装过git:
rpm -qa|grep git
如果有就删除:
rpm -e --nodeps +包名
注:当前文件夹是/etc
接着就开始安装
执行如下命令(预编译git,最终被安装到了/usr/local/下)
./configure --prefix=/usr/local/git_2.9.5
直到这样停止为止:
接着执行命令:
make && make install
结果提示少个zlib.devel包,那就装上吧。
执行命令:
yum install zlib-devel
安装过zlib.devel之后是这样:
接着安装git:
make && make install
这次又出现问题,说是缺少一个perl包:
那就用yum命令安装:
执行命令:
yum install perl-ExtUtils-MakeMaker
安装perl包之后是这样:
还是接着执行:
make && make install
这次没报错,但是还缺一步,给它定义个软连接:
执行命令:
ln -s /usr/local/git_2.9.5/bin/* /usr/bin/
接着执行命令:
git --version
可以看到版本号,说明git安装好了,愉快的开发吧>>>
总结一下Linux系统git的安装过程:
git --version //检查之前是否存在git,有则删除对应的包
cd git-2.9.5 //进入解压后的 git-2.9.5
./configure --prefix=/usr/local/git_2.9.5 //预编译
make && make install //预编译后执行安装命令
ln -s /usr/local/git_2.9.5/bin/* /usr/bin/ //加一个软链接
git --version //查看git是否安装成功
为了节约下次安装时间:
链接:https://pan.baidu.com/s/1na9Le8UNQQe0fMoe1UTNMQ 提取码:uttr