網址:https://git-scm.com/book/zh/v2/起步-安裝-Git
https://git-scm.com/book/zh/v2/%E8%B5%B7%E6%AD%A5-%E5%AE%89%E8%A3%85-Git
相信有很多人通過官網在下載git的時候發現網速只有幾十K,淘寶有一個鏡像的網站 可以提供下載
https://npm.taobao.org/mirrors/git-for-windows/
已經完成Git安裝,如何查看是否已經安裝成功,Windows+R 打開命令窗口 運行cmd
git --version
現在進行Git的最小配置
在使用git前需要對git做最小配置。也就是需要配置user.name和user.email
如果不做最小配置,git是無法使用的。
$ git config --global user.name ‘your_name’
$ git config --global user.email ‘[email protected]’
- 上述的global表示對登錄用戶的所有倉庫有效
- your_name可以設置爲自己喜歡的名字
- [email protected]可以設置爲自己的郵箱
git config的其它作用域
上面是配置的global域,config還有其他作用域:
$ git config --local local只對倉庫有效。此也爲缺省條件下的配置
$ git config --global global對登錄用戶的所有倉庫都有效
$ git config --system system對系統的所有用戶都有效
當你設置好config的配置後,如果想查看配置信息,加
--list
即可。如下:
$ git config --list --local
$ git config --list --global
$ git config --list --system
如果想清楚config配置,使用
--unset
。如下:
$ git config --unset --local user.name
$ git config --unset --global user.name
$ git config --unset --system user.name
上面三個作用域是由一定的優先級的:local > global > system
總結:
-
學會Git的最小配置
-
git config [–local | --global | --system] user.name ‘Your name’ git config [–local | --global | --system] user.email ‘Your email’
查看配置
參考文章:
【Git、GitHub、GitLab】一 Git安裝與Git最小配置 - 「dt貓」 http://www.luyixian.cn/news_show_9816.aspx
Window下的git配置文件在哪裏【圖文】-百度經驗 https://jingyan.baidu.com/article/870c6fc3589f22b03fe4be95.html