warning: push.default is unset的解決方案

在執行 git push 時看到以下消息:git

warning: push.default is unset; its implicit value is changing in  
Git 2.0 from 'matching' to 'simple'. To squelch this message  
and maintain the current behavior after the default changes, use:  
  
  git config --global push.default matching  
  
To squelch this message and adopt the new behavior now, use:  
  
  git config --global push.default simple

經百度後,得知‘matching’ 參數是 Git 1.x 的默認行爲,其意是若是你執行 git push 但沒有指定分支,它將 push 全部你本地的分支到遠程倉庫中對應匹配的分支。而 Git 2.x 默認的是 simple,意味着執行 git push 沒有指定分支時,只有當前分支會被 push 到你使用 git pull 獲取的代碼。shell

根據提示,修改git push的行爲:this

git config --global push.default matching

再次執行git push 獲得解決。
spa

相關文章
相關標籤/搜索