2) Standard Git Workflow Lesson

Git Clone

3 min to complete · By CodingNomads Team

The Git command git clone is used to "clone" an existing remote repository on GitHub, for example, to your local machine. By executing the command, you create a local copy of a repository that already exists remotely on GitHub, GitLab, BitBucket, or a private server within your company.

Git Clone Command

Here's the command syntax for the git clone command:

$ git clone <URL>

You need to replace the <URL> part of this command with the URL of the remote repository you want to clone. A full working command could look, for example, like this:

$ git clone https://github.com/CodingNomads/testing_git.git
Colorful illustration of a light bulb

Info: No need to clone this repository right now; you will work with it in just a bit.

Git Clone vs Git Init

It isn't uncommon to mix up git init with git clone. However, they accomplish different things:

  • git init is used to initialize a new repository
  • git clone copies an existing repository using its URL
Colorful illustration of a light bulb

Info: You will learn more about git init in an upcoming lesson.

Cloning in Git

There are different ways of cloning a remote repository from GitHub:

  1. Using the https URL in our terminal
  2. Using an ssh key
  3. Downloading a zip file
  4. Clone with the GitHub CLI

In the next lesson, you will learn to use these different methods for getting a local copy of a remote repository.