Configuring SSH and GitHub
Until last August, you could use a user name and password to log into GitHub. GitHub has deprecated using a password in that way. Instead, we will be authenticating GitHub using public/private based keys. This is a short overview for how to do authenticate in this way.
- First, type
credentials::ssh_setup_github()
into your console.
- Second, R will ask “No SSH key found. Generate one now?” You should click 1 for yes.
- Third, you will generate a key. It will begin with “ssh-rsa….” R will then ask “Would you like to open a browser now?” You should click 1 for yes.
- Fourth, you may be asked to provide your username and password to log into GitHub. This would be the ones associated with your account that you set up. After entering this information, you should paste the key in and give it a name.
You should not have to do this every time.
Your turn!
The link for today’s application exercise is at: https://classroom.github.com/a/KBJlnRKM.
- Click on the green CODE button, select Use SSH (this might already be selected by default, and if it is, you’ll see the text Clone with SSH). Click on the clipboard icon to copy the repo URL.
Clone the repo and make a new project in RStudio.
You should see the files for the Flint Water Crisis analysis in the Files pane.
Configure git by running the following code in the terminal. Fill in your GitHub username and the email address associated with your GitHub account.
git config --global user.name 'username'
git config --global user.email 'password'
This you will have to do more often.
Open the RMarkdown file ae02-flint.Rmd. We will use that for the next part of class. There is also an ae02-flint.html file.
Put your name for the author, then knit the document.
Select all of the updated files in the Git pane, click to commit and write the commit message “Updated author name”.
Click to push your changes.
If you refresh your repo on GitHub, you will see the updated files with your commit message.
Flint Water Crisis analysis
Follow along with the instructions in app-02-flint.Rmd. An html version of the file can be found in the repo as well.