Windows下msysGit使用及相關配置


 

  Windows下msysGit使用

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

  1、創建工程目錄

  windows下進入msysGit目錄下點擊msys.bat,進入命令行

  mkdir–p /d/workspace/

  2、從版本庫clone版本

  git clone git@192.168.10.49:hello.git

  3、配置本地msysGit  

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

  a、進入你的工程目錄
  cd /d/workspace

  b、設置你的用戶名和郵件
  gitconfig --global user.name "guoyun"                       #設置姓名,這里不同於現有svn請務必設置你名字的全拼,因為姓名首字母以后有新人進來總會有重復

  gitconfig --global user.email "username@email.com"     #設置郵件

  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        #設置分日志功能,可以找到重置后的提交。一些誤操作后比較有用可以找回誤操作丟失的代碼

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM