天天看點

Windows下msysGit使用及相關配置

  Windows下msysGit使用

  目前我們git通過ssh進行通信,是以需要你也安裝ssh以及将ssh key發給我,省得每次都需要輸入使用者名和密碼

  1、建立工程目錄

  windows下進入msysGit目錄下點選msys.bat,進入指令行

  mkdir–p /d/workspace/

  2、從版本庫clone版本

  git clone [email protected]:hello.git

  3、配置本地msysGit  

  git可以針對每個git工程進行單獨配置,也可以全局配置。這裡我們針對單個工程進行配置

  a、進入你的工程目錄

cd /d/workspace

  b、設定你的使用者名和郵件

gitconfig --global user.name "guoyun"                       #設定姓名,這裡不同于現有svn請務必設定你名字的全拼,因為姓名首字母以後有新人進來總會有重複

  gitconfig --global user.email "[email protected]"     #設定郵件

  c、設定顔色

  gitconfig --global color.diff auto           # git diff的時候要顯示顔色

  gitconfig --global color.status auto       # git status的時候要顯示顔色

  gitconfig --global color.branch auto     # git branch的時候要顯示顔色

  d、設定指令别名

gitconfig --system alias.st "status"        # git status指令别名為gitst

  gitconfig --system alias.ci "commit"     # git commit指令别名為git ci

  gitconfig --system alias.co "checkout"   # git checkout指令别名為git co

  gitconfig --system alias.br "branch"      # git branch指令别名為gitbr

  e、設定各種編碼,避免亂碼問題

  gitconfig --global core.quotepath false #檔案名不亂碼

  gitconfig --global gui.encoding utf-8     #gui界面編碼

  gitconfig --global gui.encoding utf-8     #設定gitgui的界面編碼為UTF-8

  gitconfig --global i18n.commitencoding utf-8    #設定 commit log 送出時使用 utf-8 編碼

  gitconfig --global i18n.logoutputencoding utf-8 #設定git log輸出日志時的編碼是utf-8

  f、其他設定

  gitconfigcore.logallrefupdates        #設定分日志功能,可以找到重置後的送出。一些誤操作後比較有用可以找回誤操作丢失的代碼

本文轉自一米一陽光部落格園部落格,原文連結:http://www.cnblogs.com/candle806/p/4071419.html ,如需轉載請自行聯系原作者