天天看點

git安裝

Windows下安裝

下載下傳:https://gitforwindows.org/ 或者 https://git-scm.com/download/win

安裝步驟

1.選擇安裝元件,第一個選項是添加桌面圖示,一般不需要,第二個選項勾選,會将git bash/gui添加到右鍵菜單,Associate(關聯)兩個選項勾選,意思是關聯git配置檔案和sh檔案

2.選擇選項二,添加環境變量到path中,這樣既可以使用git bash也可以使用windows視窗指令提示符

3.選擇送出代碼行尾是否進行轉換,因為windows換行格式與其他作業系統存在差異。

第一個選項:如果是跨平台項目,在windows系統安裝,選擇;

第二個選項:如果是跨平台項目,在Unix系統安裝,選擇;

第三個選項:不進行任何轉換,非跨平台項目,選擇;

4.使用MinTTY作為終端程式,MinTTY可以執行簡單的Linux Shell指令

其他的均按照預設配置即可,最後點選 Finish 完成安裝。

安裝驗證

Linux下安裝

#安裝依賴
yum -y install zlib-devel openssl-devel cpio expat-devel gettext-devel curl-devel perl-ExtUtils-CBuilder perl-ExtUtils- MakeMaker
#解壓下載下傳的安裝包
tar -zxvf git-v2.8.0.tar.gz
cd git-2.8.0/
#編譯
make prefix=/usr/local all
#安裝
make prefix=/usr/local install           

配置環境變量

vim /etc/profile 
#在檔案末尾添加如下内容
export PATH=/usr/local/git/bin:$PATH
#:wq儲存退出
source /etc/profile
#驗證安裝
git --version           

Git相關配置

個人資訊配置

#配置使用者名
git config --global user.name "your name"
#配置郵箱
git config --global user.email "your email"           

其他配置

#關閉換行符轉換的功能(根據情況配置)
git config --global core.autocrlf false
#避免git status顯示的中文檔案名亂碼
git config --global core.quotepath off
#大小寫敏感(windows必須設定)
git config --global core.ignorecase false
#避免git gui中的中文亂碼(可忽略)
git config --global gui.encoding utf-8
#在解決合并沖突時使用哪種差異分析工具(可忽略)
git config --global merge.tool "kdiff3"           
上一篇: Git 安裝~
下一篇: git 安裝