Git repository from one machine to another

You can just clone it from the server, assuming you have access to where the clone is stored - the power of distribution ;)


This is achieved by creating a clone of the repository that is on COMPUTER B, by running the command git clone on COMPUTER C, where you want the cloned repository to be created. Cloning in git can be done using multiple protocols, including ssh, https, git; and these require an appropriate setup for the git clone command to succeed.

The easiest approach is to start the git server on COMPUTER B using this command:

> git daemon

For help with the above command, run git help daemon

Then place a marker file in the .git folder of the repository on COMPUTER B to grant permission to the git server to run the clone command on that repository. This is done by:

> cd <repository root>/.git
> touch git-daemon-export-ok

Now, from a terminal on COMPUTER C, run the following commands:

> cd <folder in which to create the cloned repository>
> git clone git://<ip address of COMPUTER B>/<full path of the repository on COMPUTER B>

This will create the cloned repository on COMPUTER C.


You can either pull from the network location or copy the entire directory(containing .git folder) accross to the other computer.

Tags:

Git