Reputation: 4167
So I have a git repository that i pulled at one point and that repository resides on a server. I don't have access to the original repository that I pulled it from. How do i get the code from the existing server to another computer?
EDIT 1: So here's what it looks like:
Can i just do a simple copy of that directory without using git, or can I use git to clone if from B to C?
Upvotes: 21
Views: 44433
Reputation: 103
If anyone has any issues with cloning, I used simply this, on the machine you want app to be cloned to:
cd C:/my_apps/
git clone [email protected]:user/my-app.git
(use SSH link you copied)Done
Upvotes: 2
Reputation: 330
If I understand the question right, you just want to transfer the history of code from B to C. Actually because git uses de-centric model, B has complete history of the code till the last sync point between B and A.
I can think of three methods if you just want to transfer code history from B to C:
Upvotes: -2
Reputation:
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.
Upvotes: 35
Reputation: 2347
You can run from computer C:
git clone username@computer_B:path/to/root/of/repository
assuming that computer B has a ssh server running. Otherwise other protocols are supported (file://, http://, \\computer_B (NetBios), ...)
Upvotes: 2
Reputation: 10366
You mean you wanna clone it to a different computer?
How about:
git clone ssh://myserver/path/to/myproject.git
Upvotes: 1
Reputation: 76500
You can either pull from the network location or copy the entire directory(containing .git folder) accross to the other computer.
Upvotes: 8
Reputation: 7474
You can just clone it from the server, assuming you have access to where the clone is stored - the power of distribution ;)
Upvotes: 3