How to install Git and clone a GitHub repository (part 4 of Series)

24 January 2019  
 3 min read

Are you new to coding? This series of articles is a beginners’ overview of version-control, Git and GitHub.

In this article we’ll install Git onto your computer “clone” your first repository.

With this simple knowledge, you’ll have ready access to a vast number of open-source public repositories. This can be an amazing learning resource!

In part 1 of this series, we learn that GitHub is an online service for hosting your Git repositories.

In part 2 of this series, we learn some of the key concepts and terminology related to Git.

In part 3 of this series, we learn how to use GitHub to create a new empty repo.

In part 4 of this series, we install Git on our local machine and clone our new GitHub repo.

In part 5 of this series, we learn how to begin working with Git - how to commit files, how to push them to GitHub and more.

In part 6 of this series, we learn how to work with Git branches - how to create them, move between them and merge changes.

Install Git onto your computer.

  • Go to the Git website and download an installer appropriate for your computer.

image showing Git install page

  • After installation has completed, you can verify that Git has installed correctly by:

    • Opening a new terminal/console on your computer. Link to how to do this on Windows, on a Mac and on Linux (Ubuntu)

    • Enter the following command. The response should tell you which version of Git you currently have installed.

git --version

Clone your repository using the Git Command Line Interface (CLI)

  • On the GitHub website, navigate to the main page of your new “HelloWorld” repository that you created in part 2 of this series (if you haven’t done this, you need to go back and work through the steps).

  • Click the green Clone or Download button and then click the ‘Copy To Clipboard’ button. This will copy the URL to your repository into your computer’s clipboard, ready for use in a moment.

image showing GitHub clone buttons

  • Open a new terminal/console on your computer.

  • Change your current directory to be where you want the clone to be made.

On my Windows system, I keep all of my repos in a folder called source\repos in my user profile. So you could use a command like this:

cd C:\users\<your username>\Source\Repos\

Note that you don’t have to create a new folder manually - the act of cloning will automatically create an appropriately named subdirectory. I make this mistake all of the time, ending up with two folders with the same name nested!

  • At the prompt, enter the git clone command, pasting in your own URL that you copied a moment ago (replace my URL in the example below, with your own):
git clone
  • You should see a result similar to this:

image showing git clone command

  • Now the clone itself has been done. You can verify the result by navigating into the newly created ‘Helloworld’ folder, using cd helloworld and list the contents using the dir or ls command.

You should see just the two files that were automatically created for you, when you first created the repo in GitHub.

image showing cloned folder

Next, in part 5 of this series, we’ll introduce you to some of the ways you work with Git.

PREVIOUS : Read part 3 : Creating a new repository using GitHub

NEXT : Read part 5 : Introducing the Git workflow


2021 (1)
2020 (26)
2019 (27)