How people use GitHub (not just storing code)
- Searching uses of different functions
- Finding new packages
- Sharing work
- Package development!
- Following interesting people (social media, but way more fun!)
- Q & A through issues
- Substituting for a long work history (and serving as a technical resume)
- Keeping knowledge wikis
- Small, static websites
- I host my blog through GitHub!
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.
- Make a GitHub account.
- Install Git.
- Install Sourcetree.
- While you’re at it, it’s nice to have a good text editor. I highly recommend Atom.
Let’s create your first repository!
- Navigate to the homepage on GitHub. It should look something like this layout (with much less text most likely)
- Either click the green
New Repository
button on the right side of the screen or the+
andNew repository
on the top of the screen. You should now see a screen that looks like this.
- 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!
-
Click
Create repository
at the bottom of the screen! -
In the main page of the repository, click the green
Clone or download
button and copy the URL.
-
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. SelectEdit Accounts...
and then click on your account. For protocol it should say HTTPS. If it says SSH, change it. -
Click
Clone
at the top of the page. Your screen should look like this!
-
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.
-
Click the blue
Clone
button at the bottom of the screen. -
You now have a local repository! Let’s make a file and add it to GitHub.
Push a file to GitHub.
-
Navigate to Atom!
-
Save the empty file as
test.md
in the new folder you created. -
Write something in it! For example, what’s a fun thing you’ve done in the last week?
-
Save that file. Go back over to Sourcetree.
-
You should see your new file in the
Unstaged files
section of the homepage of your folder.
-
Click on it to highlight it and then click
Stage selected
. It should now be in thestaged
section. -
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”.
-
For ease, select the box that says
Push changes immediately to origin/master
. Then clickcommit
! -
Go check your repository on GitHub to make sure your new file is there!
Other helpful things
- Learn how to create branches for better workflow
- Learn .gitignore files to manage sensitive or large items.
- GitHub from RStudio/Atom
Resources
- Suzan Baert’s Reflections of 4 months of GitHub
- Jenny Bryan’s Happy Git with R (beginner)
- Mike McQuaid’s Git in Practice (intermediate/advanced)