4 - Git Conf
Note, this is here from my STAT 5014 class. I have brought it over for those interested. Basically, we need to have:
- Git and github configured
- Git configured locally to allow pushing to your personal repo
- Me
invited as collaborator.
Step 1: get Git
Download git from https://git-scm.com
Step 2: sign up for a Github account
Step 3: configure your ssh keys
In Rstudio:
- Go to Terminal (lower left). If you have a key, skip to step 4.
- Type
ssh-keygen
in the terminal window. - Ideally you will use a short passphrase different from your pid password, but can simply hit enter for most (or all prompts).
- Once done, type
cat ~/.ssh/id_rsa.pub
and copy the entire output. - You now need to add this to your GitHub profile. In Github, click on the pulldown (top right) to view your profile and choose settings then SSH and GPG keys.
- Click on New SSH key, paste your RSA public key there and save.
Step 4: configure your local Git
To do this, type the following in your Rstudio Terminal:
git config --global user.email "you@example.com"
git config --global user.name "Your GitHub USER Name"
Step 5: create a new repo for your coursework
Create a new repo named STAT_5014_2019_<pid>
. Where <pid>
is your VT pid by hitting the New button. Don’t add a readme at this time but do add me as a collaborator under settings (please use rsettlage, not my pid).
Step 6: clone the new repo to your local computer
In the Rstudio terminal window, change directories to where you want your coursework to live, for instance cd ~/Documents/
. Now copy and paste the directions from GitHub to create a new repository from the command line. For me, this looks like:
echo "# STAT_5014_Fall_2019" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin git@github.com:rsettlage/STAT_5014_Fall_2019.git
git push -u origin master
If this set of commands is successful you are all setup and have made your first commit. If you refresh the Github page, you should see your README.
If you want to read more about this:
https://services.github.com/on-demand/downloads/github-git-cheat-sheet/