Do I need a server to use git?

后端 未结 7 2227
北荒
北荒 2021-02-06 14:39

If I need to get access to my files on my home computer from work or whatever, do I need to have a network server and check-in the files on there?

If I\'m using g

7条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-06 14:51

    Since GIT is decentralized, you have a complete copy of your repository on each system. This leaves you flexibility to adopt a workflow for synchronizing your repositories that works for you. Given what you said in your question I would recommend one of two options.

    Synchronize your Home and Work repositories via ssh

    If your home machine and work machines are both accessible from the internet, then you can just ssh from one to the other and push pull changes to each local repository. So:

    1. SSH to your other machine (other being either work or home)
    2. Pull down any remote repository changes
    3. Push up any local repository changes.

    Synchronize your Home and Work repositories via central repository

    This involves syncing both your work and home repository changes with a third repository location, which can be either on a hosted service like Unfuddle or GitHub, or any web-hosting service that gives you ssh access.

    I prefer the second approach because it gives you a third copy of repository at yet another offsite location.

提交回复
热议问题