RHEL/Fedora/CentOS yum 安裝
| yum install git git-svn git-email git-gui gitk |
從源代碼進(jìn)行編譯安裝
1. 先下載最新的 git 穩(wěn)定版源碼
| wget https://git-core.googlecode.com/files/git-1.7.10.tar.gz |
2. 解壓源碼,并進(jìn)入源碼目錄
| tar xzvf git-1.7.10.tar.gz cd git-1.7.10 |
3. 編譯安裝
| ./configure prefix=/usr/local make && make install |
可能出現(xiàn)的錯(cuò)誤:
a. msgfmt: command not found
解決方法:yum install gettext
b. 安裝完畢執(zhí)行g(shù)it,提示“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 命令補(bǔ)全功能
a. 復(fù)制命令補(bǔ)全腳本到 /etc/bash_completion.d/ 目錄(沒(méi)有則自行創(chuàng)建)
| cp contrib/completion/git-completion.bash /etc/ |
b. 載入 git 命令自動(dòng)補(bǔ)全腳本,使之在當(dāng)前的 shell 環(huán)境中生效
| . /etc/git-completion.bash |
這時(shí)候你就會(huì)發(fā)現(xiàn)自動(dòng)補(bǔ)全已經(jīng)生效了。試試輸入”git com”, 再按下 TAB 鍵看看吧。
c. 為了命令補(bǔ)全功能能在下次啟動(dòng)終端時(shí)自動(dòng)啟用,需要在 /etc/profile 與 ~/.bashrc 中添加如下內(nèi)容:
| # Git commands autocompletion if [ -f /etc/git-completion.bash ]; then . /etc/git-completion.bash fi |
附:Windows 環(huán)境使用 Git 的相關(guān)工具
1. Cygwin http://www.cygwin.com/
2. msysGit http://msysgit.github.com/
3. TortoiseGit http://code.google.com/p/tortoisegit/
posted on 2012-07-17 21:54
小果子 閱讀(1811)
評(píng)論(2) 編輯 收藏 引用 所屬分類(lèi):
學(xué)習(xí)筆記 、
Linux