一、下載Git安裝包
官網下載地址:https://git-scm.com/downloads
官網下載太慢,可以到此處下載對應版本:https://npm.taobao.org/mirrors/git-for-windows/
二、設置環境變量
將安裝目錄下的bin文件夾路徑設置到環境變量的path參數中,這樣可以在任意目錄調用git命令
三、Git配置
Git的配置文件.gitconfig默認放置在用戶根目錄下,C:\Users\username
修改配置時,可以直接修改此文件,或者通過git config命令修改
設置用戶名和郵箱
git config --global user.name “你的用戶名”
git config --global user.email “你的郵箱”
設置commit模板
創建模板文件xx_template
git config --global commit.template "模板文件完整路徑"
設置賬號密碼:
在用戶根目錄下創建文件.git-credentials,將https訪問路徑帶上用戶名寫入文件
eg: https://username:[email protected]
通過如下命令配置賬號密碼訪問本地文件:
git config --global credential.helper store
四、查看Git配置
命令:git config --list