Course Content
GitHub Fundamentals
GitHub Fundamentals
Cloning a Remote Repository
Cloning
Once a remote repository has been created, you can create a local copy by using the git clone
command with the URL of the repository. However, before running any commands, let's first recap how to open the Terminal (Git Bash) on your operating system.
Now, you will need the URL, so follow the instructions in the video below to learn how to copy the URL of your repository on GitHub.
With the URL copied, we are now ready to clone our remote repository via running the following command in the terminal and replacing <url>
with the actual URL of your repo:
As you can see, we have successfully downloaded a copy of the remote repository from GitHub to our local machine. Additionally, a directory named github-playground
was automatically created, containing the entire working tree.
Let's now switch to this directory and list all its non-hidden files and directories:
Essentially, our repo contains only a single README.md
file, which was created automatically with the repository in the preivous chapter.
Committing Changes Locally
Let's now modify this file by editing its contents. We will use the Vim editor for this. To open the README.md
file in Vim, run the following command:
First, you have to enter insert (edit) mode in Vim by pressing i
. This allows you to edit the text. Next, let's add the following line to our README
file:
To exit insert mode, press the Escape key. Afterward, to save the changes and exit, type :wq
and press the Enter key:
Let's now check the status of our working tree:
As you can see, it is stated that the README
file is in the modified state, so we can now stage and commit this change in a single command:
Thanks for your feedback!