cento os yum 安装Git

If you haven’t set up the Webtatic repository in yum, then add it in the command-line as following:

rpm -Uvh http://repo.webtatic.com/yum/centos/5/latest.rpm


Now install git:

yum install --enablerepo=webtatic git-all


git 的几个命令解释

git-init-db                // 新建初始化库
git add *.c *.h                // 添加文件
git commit –a –m ‘inital’     // 提交修改,-a 表示全部
git branch third // 新建一个名为third的分支
git reset –hard commit   // commit 为指定版本,同时所有在commit版本之后的修改全部废弃,无法返回
git reset –soft commit    // commit 为指定版本,代码不变commit信息没有了
git checkout testing    // 切换到testing分支


手工安装法:

//先安装git依赖的包 
yum install zlib-devel 
yum install openssl-devel 
yum install perl 
yum install cpio 
yum install expat-devel 
yum install gettext-devel 


//安装autoconf 
yum install autoconf 

//安装git 
wget http://www.codemonkey.org.uk/projects/git-snapshots/git/git-latest.tar.gz 
tar xzvf git-latest.tar.gz 
cd git-{date} 
autoconf 
./configure --with-curl=/usr/local 
make 
make install


Fedora上安装Git
$ wget http://kernel.org/pub/software/scm/git/git-1.7.3.5.tar.bz2
$ tar -xjvf git-1.7.3.5.tar.bz2
$ cd git-1.7.3.5
$ make prefix=/usr all ;# prefix设置你的Git安装目录
$make
$make install

你可能感兴趣的:(cento os yum 安装Git)