UMCarpentries / intro-curriculum-r

Custom curriculum for teaching R, the Unix Shell, & Git with an integrated workflow and reproducible research practices.

Home Page:https://umcarpentries.org/intro-curriculum-r/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add instructions for setting up SSH keys with GitHub

kelly-sovacool opened this issue · comments

Pushing to and pulling from GitHub now requires either an SSH key or a PAT in the command line. Put this content somewhere around the config/setup section. See SWC version here for inspiration: https://swcarpentry.github.io/git-novice/07-github/index.html#ssh-background-and-setup

So it might be easiest to set up the PAT in RStudio. The usethis package has a lot of helper functions for this. See https://usethis.r-lib.org/articles/articles/git-credentials.html. It does not appear that usethis is in the tidyverse package so we would have to add install instructions for that. In theory it should interact with the OS credential manager so you can set it up in RStudio and still use at any command line. RStudio recommends using HTTPS over SSH. The usethis::git_sitrep() command is useful to get an overview of how things are set up on your system.

Since the R session comes first, I think it makes sense to use RStudio to set things up. Is there a strong reason to prefer SSH over HTTPS? Is it possible to get access to "fresh" system images to test these methods on?

I tend to think we should show how to do it without RStudio for a few reasons:

  1. in case we would like to develop a parallel version of the curriculum that uses Python
  2. in case someone comes across our curriculum online and they're only interested in the git material
  3. to avoid adding a new dependency (although I'm a big fan of usethis...)

I'm not sure about SSH vs HTTPS.

I'd prefer the easiest possible way for the learners. The thought of them having to mess with ssh keys is a bit worrisome

So far I've been instructing people to do the following to use a PAT:

  1. Make sure the credential helper is set to store by running git config --global credential.helper store.
  2. Create a PAT in GitHub settings on the web and copy it to your clipboard. (on GitHub.com: click your profile > Settings > Developer settings > Personal access tokens > Generate new token).
  3. Do something such as a pull/push on the command line to make git ask for your PAT. Paste it in. The credential helper will remember it so you shouldn't ever have to do that again on your current machine.

No SSH keys involved!