-
Notifications
You must be signed in to change notification settings - Fork 11
git
git is a software system to help us build, manage and share a repository of documents. git applications run as command-line tools on macos, Windows and linux, but there are many graphical user interfaces (GUIs) to make using the tools easier. Collections of documents are organized into repositories, and git is used to manage those documents for you.
github is a vendor of cloud-based services to host your git repositories. There are competitors to github including bitbucket and gitlab. We’ll use github for this course.
This document is a barebones manual for creating a github account, installing git (if you don’t have it already), and then connecting your computer and your RStudio installation to github.
If you already have an account with github you can skip to the git section.
Follow the registration menu at github. Keep in mind that this is a public venue that you may use for years to come; be sure to choose an appropriate username, photo and other information with that in mind.
Like any password, keep these credententials in a secure place (like a password manager).
git software must be installed on your machine. Open a terminal on you computer.
Type the following in the terminal.
git --version
If you get a meaningful response then skip to Connect RStudio and git. If not then you need to install git. A meaningful response might look like this…
git version 2.39.5 (Apple Git-154)
Select the appropriate link for accessing the software to download and install git.
Once you have it installed, set your global identity… name and email will suffice. These can be changed later.
git config --global user.name "Jane Doe"
git config --global user.email [email protected]
Finally we need to connect your installation of RStudio with your github account. AT this point you have github account, and you have installed and configured git. This is like passing credentials, so that git can move documents securely between the cloud and your computer.
Invoke R (or RStudio) and then do the following…
Install usethis package
In R…
install.packages("usethis")
In R type…
usethis::create_github_token()
This should bring you to a webpage with some options for generating the token.
You will need to provide a reasonable purpose for the token plus a duration - 60 days should be fine. Accept the defaults on which elements of the github offereings to permit.
Tokens are similar to passwords, so please store the token securely. If you have a password manager then use that. If you use a little notebook then use that.
Finally, we provide RStudio with a copy of that token.
In R type the command below and follow the menu that appears in the console.
gitcreds::gitcreds_set()
In theory that is it!