E - Cloning a Repository
Make sure that you've completed A to D before continuing.
By the end of this class you will:
Accept an assignment repo from Mr. Brash
This creates a new repo in your GitHub account that is a fork of Mr. Brash's repo.
A fork is a remote copy of a remote repo. It allows for experimentation / editing without affecting the original code.
A clone is a local copy of a remote repo. It allows you to synchronize between local and remote while you work on the code.
Clone the assignment repo from your GitHub account to your local machine.
Follow the instructions in the README file (read!)
Write and test your code as requested in the README
The Assignment
Programming tasks that require submission will be provided to you via a special link. From this link your GitHub account will make a copy (fork) of the repository for you.
Today's assignment is - 1.1 - Rounding
Clone Your New Repo in VSCode
In order to see and edit the code in VSCode, you will need to clone the remote repository to your local computer.
In your GitHub account, find the repo in question (it should start with 1_1-rounding)
Copy the URL of this repo to your clipboard.
Let's close our current work in VSCode so we can work on the new folder.
Go to FILE > Close Folder.Go to the Source Control menu and select "Clone Repository"
In the little window that pops up at the top, paste your copied URL to the repo and hit ENTER
Select a location on your local machine to receive the repo (a new folder will automatically be created with the name of the repo). Your repo will be downloaded.
Finally, you will be asked if you wish to open the cloned repository. Select "Open"
Viewing a README file in VSCode
The README.md file is a Markdown file. VSCode has a preview tool for viewing these. Right-click the filename README.md and select "Open Preview".
Synchronizing with GitHub
For now we will work in the main branch of the code - mostly because the task is very simple. In the future, we will immediately create a dev branch to do our work. More on that later.
While you work, you might want to make commits to your local Git repository. You are welcome to make as many as you feel is necessary. However, these are just local commits. It is tempting to click Sync Changes after each commit - this is not necessary. More on this later.
After creating the solution and thoroughly testing your code, you can synchronize your changes to the remote repository by clicking the Sync Changes button.
This particular task has some automated tests that will run in GitHub when you synchronize on the main branch. To see if your code passes the tests, head to your repo on GitHub and look for a red x, a coloured dot, or a green 🗸 next to the commit status message (see image).
Congrats! You successfully cloned a remote repo, worked on it, and synchronized your changes back to the cloud!
If you finish early - why not start thinking of a fun coding side-project.