Cloning and Forking Repositories

Version Control Essentials

Cloning a Repository

Cloning is the process of creating a copy of a remote repository onto your local machine, so you can work on it.

In this video, we will walk through the process of cloning a repository from GitHub:

Show/Hide Video

Here is Ryan's Demo1 Repository that we will be cloning in the video.

The command to clone a repository is:

git clone <remote-url>

Forking a Repository

Forking is the process of creating a copy of a remote repository on your GitHub account. This allows you to make changes to the repository without affecting the original repository. Forking is commonly used in open-source projects, where you want to contribute to a project but don't have write access to the original repository.

In this video, we will walk through the process of forking a repository on GitHub:

Note

If you want to follow along, the repository we are forking is js-movie-exercise .

Show/Hide Video

Deleting a Remote Repository

If you need to delete a remote repository, you can do so from the repository page on GitHub. Click on the "Settings" tab, scroll down to the "Danger Zone" section, and click on the "Delete this repository" button.

There will be a confirmation dialog that asks you to type the name of the repository to confirm that you want to delete it.

In the video below, I will show you how to delete a remote repository:

Show/Hide Video

Exercise 2

Show/Hide Video

For this exercise, you will need to fork and clone the following repository:

Once you have forked and cloned the repository, open the index.html file in your browser. You should see some 3d text that says "VCE".

Next, open the index.html file in your text editor and change where it says "VCE" to your name (it should be on line 14).

Save the file and go back to your browser. Refresh the page and you should see your name displayed on the page.

Finally, push your changes to GitHub, and submit the url of your forked repository below.

Hints

How do I fork a GitHub repository?

To fork a repository, go to the repository page on GitHub and click the "Fork" button in the top right corner. This will create a copy of the repository on your GitHub account.

How do I get a remote repository onto my local machine?

To clone a repository, go to the repository page on GitHub and click the "Code" button.

Copy the URL and run the following command in Git Bash:

git clone <url>
How do I push my changes to GitHub?

To push your changes to GitHub, run the following commands in Git Bash:

git add .

git commit -m "Finished Exercise 2"

git push

Submission

Once you have completed the exercise, copy the URL of your forked repository and paste it into the text area below. Then click the "Submit Exercise" button.

Solution

Walkthrough Video