如標題, 若依前前篇的方法, 把 local repository 和 remote repository 搞到同步的話, 會有一個小小的問題

當直接 git pull 時, 會有這些訊息出現

You asked me to pull without telling me which branch you
want to merge with, and 'branch.master.merge' in
your configuration file does not tell me, either. Please
specify which branch you want to use on the command line and
try again (e.g. 'git pull  ').
See git-pull(1) for details.
 
If you often merge with the same branch, you may want to
use something like the following in your configuration file:
 
    [branch "master"]
    remote = 
    merge = 
 
    [remote ""]
    url = 
    fetch = 
 
See git-config(1) for details.

後來參考這篇, 裡面的 Configure your development machine section

打這樣子的指令

cd /path/to/local/repository
git config branch.master.remote origin
git config branch.master.merge refs/heads/master

就可以在 .git/config 看到這樣子的設定

[branch "master"]
     remote = origin
     merge = refs/heads/master

經過以上的設定, 就可以直接用 git pull or git push 來和 remote repository sync

若 git remote repository 和 local repository 在同一台機器上

發表迴響

這個網站採用 Akismet 服務減少垃圾留言。進一步了解 Akismet 如何處理網站訪客的留言資料

Verified by MonsterInsights