windows下安裝git
Windows下Git的安裝與配置
參考URL:https://www.cnblogs.com/javahr/p/9766371.html
-
官網下載
Windows下載地址:https://git-scm.com/download -
安裝
出現安裝嚮導界面,點擊下一步(Next)即可。 -
設置你自己的暱稱與email
設置本地機器默認commit的暱稱與Email. 請使用有意義的名字與email.git config --global user.name "shepf" git config --global user.email "[email protected]" git config --global push.default simple
如果要使用git進行推送,則必須配置 push.default ,否則推送失敗. 姓名與Email只用於日誌標識.實際推送到GitHub等在線倉庫時,要用有操作權限的賬號登錄.
查看git配置可以使用 -l 參數(l 就是 list 的首字母,L的小寫):
git config -l
在某個項目根路徑下面可以設置單獨的Email與姓名.
git config user.name "shepf"
git config user.email "[email protected]"
git config --global push.default解釋
git config --global push.default simple 的相關解讀
原文鏈接:https://blog.csdn.net/wulove52/article/details/52357006
在git的全局配置中,有一個push.default屬性,其決定了git push操作的默認行爲。在Git 2.0之前,這個屬性的默認被設爲’matching’,2.0之後則被更改爲了’simple’。
push.default 有以下幾個可選值:
nothing, current, upstream, simple, matching
其用途分別爲:
-
nothing - push操作無效,除非顯式指定遠程分支,例如git push origin develop。
-
current - push當前分支到遠程同名分支,如果遠程同名分支不存在則自動創建同名分支。
-
upstream - push當前分支到它的upstream分支上(這一項其實用於經常從本地分支push/pull到同一遠程倉庫的情景,這種模式叫做central workflow)。
-
simple - simple和upstream是相似的,只有一點不同,simple必須保證本地分支和它的遠程upstream分支同名,否則會拒絕push操作。
-
matching - push所有本地和遠程兩端都存在的同名分支。
總結,一般我們使用simple 。該模式比較保守,只推送當前分支到遠程關聯的同名分支。
git 安裝包 國內 鏡像 地址
下載git時,先進官網看
https://git-scm.com/download/win
然後發現幾kb的網速,發現阿里有一個鏡像,下載速度超快。
網址:https://npm.taobao.org/mirrors/git-for-windows/