How do I pull from another computer's repository in Git?

If the machine you want to pull from is accessible via ssh, you can add the repository on it as a remote via ssh, and then pull from it like you would any remote:

$ git remote add repo_b username@host:path/to/repository.git
$ git pull repo_b master

(You can skip the step of adding a remote and just specify the full URL in the git pull command instead of a remote name, but if you're going to be pulling from the repository on a regular basis, adding it as a remote will save you lots of typing.)


Have a look at git pull --help

This would give something like git pull /my/other/repository


You can set up an actual server with git daemon. Otherwise, you can use git bundle, which bundles git's internal representation into a file that can be unbundled with git pull at the other end.

E.g. from the git docs, bundling everything:

git bundle create file.bundle master

Then, on the other end, you can do something like:

git pull file.bundle HEAD

Tags:

Git

Git Pull