從源代碼進行編譯安裝
1. 先下載最新的 git 穩定版源碼
2. 解壓源碼,并進入源碼目錄
PHP
3. 編譯安裝
可能出現的錯誤:
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/ 目錄(沒有則自行創建)
b. 載入 git 命令自動補全腳本,使之在當前的 shell 環境中生效
這時候你就會發現自動補全已經生效了。試試輸入”git com”, 再按下 TAB 鍵看看吧。
c. 為了命令補全功能能在下次啟動終端時自動啟用,需要在 /etc/profile 與 ~/.bashrc 中添加如下內容:
附:Windows 環境使用 Git 的相關工具
1. Cygwin http://www.cygwin.com/
2. msysGit http://msysgit.github.com/
3. TortoiseGit http://code.google.com/p/tortoisegit/