Cloning a Git Repository: A Simple Guide

Learn how to clone a Git repository from a remote server to your local machine. This process creates a copy of the repository, allowing you to work on and contribute to the project.



Git - Clone Operation

After Tom pushed his first version to the Git server's bare repository, tom can now view the changes by cloning the remote repository. The Clone operation creates a copy of the remote repository onto tom's local machine.

Clone the Repository

tom creates a new directory in his home directory and performs the clone operation:

Syntax

[tom@CentOS ~]$ mkdir tom_repo
[tom@CentOS ~]$ cd tom_repo/
[tom@CentOS tom_repo]$ git clone gituser@git.server.com:project.git
Output

Initialized empty Git repository in /home/tom/tom_repo/project/.git/
remote: Counting objects: 3, done.
Receiving objects: 100% (3/3), 241 bytes, done.
remote: Total 3 (delta 0), reused 0 (delta 0)

After cloning, tom changes the directory to the new local repository and lists its contents:

Syntax

[tom@CentOS tom_repo]$ cd project/
[tom@CentOS tom_repo]$ ls
Output

README