Git & Github (part 2)
So now that you have a git repository on your computer, and you can take snapshots of your project at any given time, lets talk about Github.
Github is a place to publicly store your repo on a server. When you do this, you have a backup of all of your commits, and other people can view/collaborate on your project. So how do you get your git repo from your computer onto github?
First, check your git user.name and user.email by opening the terminal and typing:
git config --get user.name
You should see your name show up. Now type
git config --get user.email
you should see your email show up. If you don’t see what you expect, do this:
git config --global user.name "Your Name"
git config --global user.email "email@example.com"
You’ll definitely need a github account. Go make one (or log in). Make sure you use the same email address for github that have configured for git! You also need to set up an SSH key, which you can do by following this link
Alright, you’re ready to put your local repo onto github.
First, open your terminal and prove to github that you are in fact who you say you are by typing:
ssh -T firstname.lastname@example.org
You should see a message like the following:
Sweet, Github now trusts you!
Ok, go to github and create a new repository (click your the + icon next your your username)
Give it a name and a description. Preferably the name should match the name of your directory on your computer. I’m calling mine homework_assignments. You probably don’t want to change any of the default options. Leave them as public and DO NOT check the box that says “initialize this repository with a README”
You should see a screen that contains this:
You’ll want to follow the prompts for “Push an existing repo…”
From then on, whenever you make a commit from your terminal, can can simply type
in the terminal from your git directory, and your commit will now be on github.