Learning Version Control with GitHub
- Part 1: Why Use Version Control?
- Part 2: Using GitHub
- Part 3: Working with Repositories
- Part 4: Markdown and Code
- Part 5: Managing Repositories
As introduced in a previous part, Github is:
a website that uses Git to track things in repositories. In Git, a repository, sometimes called a “repo” for short, is a collection of files. Users can create them, add collaborators, and even work across repositories as well.
Private repositories cost usually money to use on GitHub, but public repos can be created for free for those who have accounts on the site.
Creating an Account
Visiting Github.com prompts to a create a username and password and supply an e-mail address.
Creating an account will cause GitHub to send an e-mail.
In a new tab, window, or separate application, open the e-mail account used for signing up and find the e-mail GitHub sent. Click on on “Verify email address” within the message.
Close the new tab or window created by verifying the account and return to the previous one.
Click on “Create an account”.
Make sure “Unlimited public repositories for free” is selected and click the “Continue” button.
On the next screen, fill out the information or click “skip this step” to ignore the survey.
Forking a Repository
While projects can be created and used on GitHub, one of the most common actions is to fork a project someone else or a group created. In Git terminology, forking a project means to copy their project into your account.
While logged into GitHub, visit the repo Learning GitHub
Click on the “Fork” button in the upper, right-hand corner.
GitHub will clone the files from one repository to another.
GitHub Desktop Application
While projects can be managed from the website version, it is often more convenient to work on files on a local device and then upload them to the website. This allows for working on files without needing to be connected to a network and to make all changes before submitting them.
There is a desktop application for GitHub named GitHub Desktop. It can be found on its own site.
Once downloaded and installed, opening the application will prompt for a login. Click on “Sign into GitHub.com”
Enter the same username and password used when signing up on GitHub.
The GitHub Desktop application will guess at a name and create a unique, new e-mail address for using Git. Click “Continue”
Finally, choose to send anonymous usage data or not by unselecting or leaving the “Yes, submit anonymized usage data” select blank or not. Click “Finish” to continue.
Cloning a Repo
By default, there will be no repositories found. To fix that, click on “Clone a repository” to download files from GitHub to the local device.
Select the “Learning-GitHub” repo forked earlier.
Note the location in the “Local Path” area of where the files will be stored. To change this, click “Choose…” and file another folder or directory for the files.
Click “Clone” to download the files.
On the right-hand side, the GitHub Desktop application will note that there are “No local changes.” Since the files where just cloned, this makes sense. No changes have been made yet.
As part of working with GitHub, the GitHub Desktop application watches for file changes and helps with managing version control of these files.
Clicking on “open this repository in Explorer” will open the folder or directory holding the files. With only a single README.md, there are no other files or changes right now.