Clone a remote repository
GitHub makes it easy to share your coding projects. The process of downloading a GitHub repository to your computer is called “cloning.” When you clone a repository, you get a copy of its history as a local Git repository. Downloading (in contrast to closing) a repository just downloads the files from the most recent commit. Let's try it.
In the better-sleeptime
, delete all the files! (you can try the command rm -rf ./* ./.*
)
Next, run the following command but replace <repository>
with the URL of your GitHub repository (the one we made in the previous steps). Notice the trailing dot (.
) at the end of the command which indicates to copy the repository content in the current folder.
git clone <repository> .
You now should have all the files you had deleted! This is a clone (a copy) of the GitHub repository.