Skip to content

git clone#

Previously we've used git init to create a repository locally. Now we're going to clone an existing one, because GitHub has already created the repository for me.

Before you can clone the repository, you need the address of it on GitHub. This is made super easy for you. You need to click the Code button and get the SSH address:

Note

The SSH address will already be visible if you've added an SSH public key to your GitHub profile. If not, then the HTTPS address will be visible and you'll need an SSH key to proceed with these instructions.

You can technically keep going using HTTPS, but I would not recommend it.

GitHub Clone Address

GitHub Clone Address

So click 1, then click 2 (the icon) to copy the address.

Now you're ready to clone the repository. Clone the repository to your Ubuntu systems:

Note

We had to accept the remote SSH finger print of the GitHub server because we've never accessed it before. That'll be something you'll have to do as you access remote Git servers.

Without the SSH fingerprint, the above looks like this:

1
2
3
4
5
Cloning into 'uploadacademy-itopslevelone-a'...
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Receiving objects: 100% (3/3), done.

Now if I look at a tree of my local ~/git/ directory, we can see the newly cloned repository and its contents:

1
2
3
4
5
6
$ tree
.
└── uploadacademy-itopslevelone-a
    └── README.md

1 directory, 1 file

There's not much happening here, but we've successfully cloned the repository locally, enabling us to work with it. We'll do that next.