Introduction to Git and GitHub

Session - Prework for a computer

Zoë Turner

Check Git

Check if Git is already installed. Run the following in the Terminal (not the RStudio Console!)

which git

Check the version of your Git

git --version

If asked to install the Xcode command line tools, say yes! Right click to copy on a Terminal line

Downloading Git

Installer hangs at 100%

If the installer hangs with the progress bar at 100%, close the installer with Task Manager (press Ctrl + Alt + Delete;
select Task Manager;
find Git for Windows installer and close).

Connecting RStudio to Git

  • Open RStudio
  • In the menus go to Tools > Global Options > Git/SVN
  • Check RStudio has found Git under “Git executable:”

You may need to click Browse and find the Git executable

Where to find the git.exe

It may be under C:\Users\username\AppData\Local\Programs\Git\ - remember if file extensions are hidden it will show as git rather than git.exe.
Restart RStudio before trying to use git.

GitHub

Register a GitHub account at github.com.

  • Suggest to incorporate your actual name/reuse your username from other contexts (like Social Media)
  • Pick a username you will be comfortable revealing to your boss
  • Shorter is better
  • Be as unique as possible in as few characters as possible
  • Make it timeless
  • Avoid words laden with special meaning in programming
  • Use all lower case letters

Think about security

Particularly for GitHub and your own account safety

Set up 2FA (two-factor authentication) using an app or save the generated code

Install packages

The following packages are required for the course:

install.packages("gert")
install.packages("usethis")
install.packages("gitcreds")

End session

Acknowledgements

These slides were designed by Mine Çetinkaya-Rundel and Emma Rand for the Forwards Package development module course

Your first package and Setting up your system