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.
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 |
|
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 |
|
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.