Skip to content

2.0: Getting started with GitHub

What are git and GitHub?

Github (github.com) is a website, whereas git is a computer program. Today we will mostly be learning about GitHub, and saving the more complicated topic of git for next week. But to understand why Github is useful you will need to understand a little about its relationship to git, and what git is used for.

Git

git is a type of version control software. In its most simple form, git is a program for tracking changes that are made to files over time. This is useful not only as a type of time-machine -- allowing you to go back to previously saved versions of files -- but also as a mechanism for syncing files between multiple locations (e.g., multiple different computers) and/or among multiple potential users. The true power of git comes from its methods for resolving conflicts when multiple users make changes to the same files. It is a collaboration software which helps a user to resolve conflicts and to store one or more versions of files at the same time.

Any folder on your computer can be made into a git repository by activating the git program inside of that folder. This allows you to tell git which files should or should not be tracked for changes. The entire folder full of files and/or subfolders can then be synced between machines. Because computer programs often involve many files and folders that must be maintained in a specific structure, git provides a useful framework for syncing changes to these files (the repository) across machines.

Is git installed on your machine? Probably. If you are on Linux (or using Windows Subsystem for Linux 2) then you will have git installed by default. If you are on OSX then it may be installed. Open a terminal and try the command below; if git is not installed your terminal will prompt you to install the Xcode command line tools, which includes git as well as several other tools you will want.

$ git --version

GitHub

GitHub is a website. In the sense that git is used to sync a repository across machines, you can think of GitHub as hosting a machine that exists in the cloud. It is of course useful to keep a cloud-based copy of your repository since cloud servers are generally a reliable backup that will never be lost -- as opposed to your own laptop which could crash and burn (hackers reference) at any time. Another advantage of keeping your repository backed up in the cloud is that if multiple users intend to access it, the cloud-based version will always be accessible -- if by contrast it was stored on your local computer, you may at some point disconnect your computer. So in summary, GitHub provides a cloud-based storage location for git repositories.

But GitHub actually does much more than this as well. It acts as a social network for developers, by making the contents of git repositories openly readable (unless purposefully kept private) and shared with all users. There are several websites that serve similar functions to GitHub (such gitlab, bitbucket, sourceforge) but the community has mostly coalesced around GitHub. Its a bit like a Facebook versus Friendster battle, you can use one of the alternatives, but nobody is likely to see your content.

How we will use GitHub

You will need to have a GitHub account for this course. To signup you only need an email address. The service is completely free and is a highly trusted source that will not overrun you with spam, so feel free to use your school email address if you like. If you already have a GitHub account feel free to use it for this course, or to create a new one using a separate email address. You will be required to create several git repositories throughout this course. Choose your GitHub username wisely. This is your public profile as a developer. It is how many people will become familiar with your work, and it can even help you to land a job in the tech industry. As an example, I use "dereneaton" and "eaton-lab" as the usernames for my two accounts. To create a new account:

  • Go to https://github.com and find the Sign-up button near the top.
  • Create a username and enter your email address.
  • Follow instructions to create a free account.

Assessment

Complete the tasks in this section to earn points for the assignment.

Task 1

Complete the hello-world exercise from the github guide. When you finish creating your account you may be prompted to complete the GitHub starting guide. Complete all steps of this guide to create your first github repository (https://guides.github.com/activities/hello-world/). To complete this tutorial all you need is a GitHub.com account and Internet access. You don’t need to use the command line, or have git installed locally, it is completely based on the GitHub website. You will be graded on completing the creation of the 'hello-world' repository.

Task 2

Create a new repository named hack-2-shell. Just like in the GitHub Starting Guide, start by creating a new repository and name it hack-2-shell. Initialize the repository with a README file. That's it. See the other tutorials for this session for further instructions to add content to this repository.

Task 3

Submit your username so we can find your profile for grading. We will look at your public GitHub profile to find the repositories for grading. Thus it is important that you name the repos using the names that we instruct you to use. Changes are marked by time-stamps, and grading will take into account changes made after the deadline. Assignments are due before the beginning of the next class, unless stated otherwise.

Finally, to complete the assignment submit your GitHub profile name at this link


hackers-1