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.
After installation has completed, you can verify that Git has installed correctly by:
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 Downloadbutton 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.
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 clonecommand, pasting in your own URL that you copied a moment ago (replace my URL in the example below, with your own):
git clone https://github.com/SiliconOrchid/HelloWorld.git
- You should see a result similar to this:
- Now the clone itself has been done. You can verify the result by navigating into the newly created ‘Helloworld’ folder, using
cd helloworldand list the contents using the
You should see just the two files that were automatically created for you, when you first created the repo in GitHub.
Next, in part 5 of this series, we’ll introduce you to some of the ways you work with Git.