GitHub and Git Set Up

Author

Alan Arnholt

Published

Last modified on December 28, 2023 14:47:18 Eastern Standard Time

$ git config --global user.name 'Jane Doe'
$ git config --global user.email 'doej@appstate.edu'
$ git config --global credential.helper 'cache --timeout=10000000'
$ git config --global --list

Your user.name is not necessarily your GitHub username although it can be. It should be a name so that other GitHub users recognize who it is that made commits, pushes, pull requests, etc. My user.name is my actual name (Alan T. Arnholt). The last command git config --global --list shows the values in your Git configuration file. Below is what mine looks like.

[arnholtat@new-mathr STT3850]$ git config --global --list
credential.helper=cache --timeout=10000000
user.email=arnholtat@appstate.edu
user.name=Alan T. Arnholt

When you type git config --global --list in the Terminal now, it should display the values you entered for the credential.helper, user.email, and user.name.

> usethis::create_github_token()

If you are not logged into GitHub, you will be prompted to login to your account. Then, a “New personal access token (classic)” window will open where you need to enter a word in the Note box (example: PositPAT) and change the value in the Expiration box. Scroll all the way to the bottom of the window after changing the values in the Note and Expiration boxes and click on the green Generate token. You should leave all other values in the “New personal access token (classic)” window at their default values. Place the token on the clipboard. Go back to the Console in the POSIT workbench and type:

gitcreds::gitcreds_set()

At the prompt, paste your token from the clipboard in the Console after the R prompt. You should be able to work with GitHub now, i.e. push and pull.