How people use GitHub (not just storing code)

What you need to use GitHub well

I usually interact through GitHub through the shell, but to start out I think it’s easier to use a Git client. For the purposes of this exercise we will use Sourcetree.

  1. Make a GitHub account.
  2. Install Git.
  3. Install Sourcetree.
  4. While you’re at it, it’s nice to have a good text editor. I highly recommend Atom.

Let’s create your first repository!

  1. Navigate to the homepage on GitHub. It should look something like this layout (with much less text most likely)

github home screen

  1. Either click the green New Repository button on the right side of the screen or the + and New repository on the top of the screen. You should now see a screen that looks like this.

new repository screen

  1. Fill in the options as I’ve done below! The name is pretty optional, you’ll probably delete this repository eventually anyway. Select to create a README as well!

fill in the boxes

  1. Click Create repository at the bottom of the screen!

  2. In the main page of the repository, click the green Clone or download button and copy the URL.

clone the repository

  1. Navigate over to Sourcetree. First we need to make sure you have HTTPS set up as your protocol. Click Remote at the top of the screen to see your remote repositories. Select Edit Accounts... and then click on your account. For protocol it should say HTTPS. If it says SSH, change it.

  2. Click Clone at the top of the page. Your screen should look like this!

clone in sourcetree

  1. Select a location for your local repository. This should be its own folder. I’d recommend naming that repository the same way you named it on GitHub. Leave the other options the same for now.

  2. Click the blue Clone button at the bottom of the screen.

  3. You now have a local repository! Let’s make a file and add it to GitHub.

Push a file to GitHub.

  1. Navigate to Atom!

  2. Save the empty file as test.md in the new folder you created.

  3. Write something in it! For example, what’s a fun thing you’ve done in the last week?

  4. Save that file. Go back over to Sourcetree.

  5. You should see your new file in the Unstaged files section of the homepage of your folder.

unstaged files

  1. Click on it to highlight it and then click Stage selected. It should now be in the staged section.

  2. In the text box at the bottom of the screen under your name, write a short message! This should describe what you’re pushing up to GitHub. For example, I wrote “first commit”.

  3. For ease, select the box that says Push changes immediately to origin/master. Then click commit!

  4. Go check your repository on GitHub to make sure your new file is there!

pushed file

Other helpful things

  1. Learn how to create branches for better workflow
  2. Learn .gitignore files to manage sensitive or large items.
  3. GitHub from RStudio/Atom

Resources