how do I pull to a bare repository?

后端 未结 2 1633
终归单人心
终归单人心 2020-12-12 21:10

I have a \"main\" bare repository and a \"personal\" bare repository. I want to update changes form \"main\" to \"personal\", so I run:

$ git pull
fatal: /ho         


        
2条回答
  •  难免孤独
    2020-12-12 21:28

    A git pull does a fetch followed by a merge, and you can't merge without a working tree. (There would be nowhere to resolve merge conflicts if they should arise.)

    Instead, you could just fetch. Assuming your main repository is configured as a remote called origin on your personal repository:

    $ git fetch origin master:master
    

    Note that this will only be successful if the master branch of your personal repository is mirroring the master branch of the main repository. Otherwise, Git will reject the non-fast-forward fetch.

提交回复
热议问题