从源代码进行编译安装
1. 先下载最新的 git 稳定版源码
wget https://www.kernel.org/pub/software/scm/git/git-1.8.2.3.tar.gz
2. 解压源码,并进入源码目录
tar xzvf git-1.8.2.3.tar.gz
cd git-1.8.2.3
3. 编译安装
./configure prefix=/usr/local
make && make install
可能出现的错误:
a. msgfmt: command not found
解决方法:yum install gettext
b. 安装完毕执行git,提示“git: error while loading shared libraries: libcharset.so.1: cannot open shared object file: No such file or directory”
解决方法:ln -s /usr/local/lib/libcharset.so.1 /lib/libcharset.so.1
4. 安装 Git 命令补全功能
a. 复制命令补全脚本到 /etc/bash_completion.d/ 目录(没有则自行创建)
cp contrib/completion/git-completion.bash /etc/
b. 载入 git 命令自动补全脚本,使之在当前的 shell 环境中生效
1 . /etc/git-completion.bash
这时候你就会发现自动补全已经生效了。试试输入”git com”, 再按下 TAB 键看看吧。
c. 为了命令补全功能能在下次启动终端时自动启用,需要在 /etc/profile 与 ~/.bashrc 中添加如下内容:
# Git commands autocompletion
if [ -f /etc/git-completion.bash ]; then
. /etc/git-completion.bash
fi
附:Windows 环境使用 Git 的相关工具
1. Cygwin http://www.cygwin.com/
2. msysGit http://msysgit.github.com/
3. TortoiseGit http://code.google.com/p/tortoisegit/
您可以选择一种方式赞助本站
支付宝转账赞助
