How do I update my bare repo?

后端 未结 7 793
滥情空心
滥情空心 2020-11-29 16:14

I created a bare repo to publish my repository, but I can\'t figure out how to update the bare repo with the current state of the main repository.

7条回答
  •  粉色の甜心
    2020-11-29 16:44

    If you want to duplicate all the objects from the main repo, do this inside the main repo:

    git push --all 
    

    Alternatively, do a fetch inside the bare repo:

    git fetch 
    

    You cannot do a pull, because a pull wants to merge with HEAD, which a bare repo does not have.

    You can add these as remotes to save yourself some typing in the future:

    git remote add  
    

    Then you can simply do

    git push --all 
    

    or

    git fetch 
    

    depending on what repo you're in. If is origin, you can even leave it out altogether.

    Disclaimer: I'm not a git guru. If I said something wrong, I'd like to be enlightened!

    Update: Read the comments!

提交回复
热议问题