3.6 Cloning a Remote Repository

One thing we haven’t touched on yet is remote repositories. You’ve built up the mysite repository using commands that interact locally. Git can also deal with remote repositories, however, so you can share your work and get copies of others’ repositories.

To get started with a remote repository, you need to clone it using the git clone command. Cloning a remote repository does what it sounds like. It creates a complete copy of the remote repository that you can start working with.

I already have my copy of mysite shared on GitHub, a Git repository hosting service. You can try the git clone command by creating a clone of it:

 
​prompt> cd /work
 
​prompt> git clone git://github.com/tswicegood/mysite.git ...

Get Pragmatic Version Control Using Git now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.