git repository sync between computers, when moving around?

前端 未结 8 805
萌比男神i
萌比男神i 2020-12-07 07:18

Let\'s say that I have a desktop pc and a laptop, and sometimes I work on the desktop and sometimes I work on the laptop.

What is the easiest way to move a git repo

8条回答
  •  佛祖请我去吃肉
    2020-12-07 08:05

    Easiest way: central repo created with --bare (so no checked out files, only .git stuff), or github

    "Distributed" will look like that:

    Setup:

    1. On laptop: git remote add desktop ssh://user@desktop/home/user/repo/path
    2. On desktop: git remote add laptop ssh://user@laptop/home/user/repo/path

    Syncing:

    git pull laptop/desktop (push won't work very well on non-bare repos because git won't modify checked out files when pushing to remote repo)

    Or, make repo on pendrive ;)

提交回复
热议问题