[Git] Git 自學筆記 : 設定(config)

  • 2697
  • 0
  • Git
  • 2016-09-13

git 的必要常用設定

  • 設定username/email (必要)
  • 設定proxy (需要proxy才能上外網的環境)
  • 設定忽略檔案
  • 顯示設定

主要指令: git config --global

#設定username/email
# 初次設定必要

git config --global user.name "Michael Fang"
git config --global user.email "abc@gmail.com"



#設定proxy 

git config --global http.proxy http://username:password@proxy_ip:proxy_port



#設定不檢查ssl

git config --global http.sslverify false


#設定忽略檔案:global設定

git config --global core.excludesfile ~/.gitignore_global




#查看設定

git config --list

輸出如下:
core.symlinks=false
core.autocrlf=true
core.fscache=true
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
help.format=html
http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
sendemail.smtpserver=/bin/msmtp.exe
diff.astextplain.textconv=astextplain
rebase.autosquash=true
credential.helper=manager
filter.lfs.clean=git-lfs clean %f
filter.lfs.smudge=git-lfs smudge %f
filter.lfs.required=true
user.name=Michael Fang
user.email=yingchih.fang@gmail.com
core.excludesfile=C:\Users\fij\.gitignore
core.autocrlf=false

#設定儲存位置
global 設定會儲存於user home目錄的   .gitconfig
e.g windows: C:\Users\%USERNAME%\.gitconfig