Computation for Linguists

Getting Set Up: RStudio + GitHub

Dr. Andrew M. Byrd

2025-09-08

Review

What did we learn last time?

Overview of Tech Today

  • RStudio = our IDE for the course
  • GitHub = how we will backup our files
    • also how we will publish our website (and other projects)
  • What does my setup look like?

Install RStudio

Installing RStudio

  • Go here

  • Download RStudio Desktop (Open Source Edition)

  • Install like any normal app:

    • Mac → .dmg file → drag into Applications

    • Windows → .exe file → run installer

Install Git

Installing Git (Windows)

  • Go here
  • Download the latest version
  • Run installer:
    • Accept defaults, except:
      • Use “Git from the command line and also from 3rd-party software”
        • Makes Git visible to RStudio (and other apps)
      • Use “Use Windows’ default console”
        • Makes sure Git behaves normally when using RStudio

Installing Git (Windows)

  • Verify installation:
    • Open Git Bash
    • Run: git --version
    • It should tell you the version number of the Git you downloaded

Installing Git (Mac)

  • Open Terminal, located in Applications/Utilities
  • Install Xcode Command Line Tools: xcode-select --install
  • Verify Git Installation with git --version

Set Up GitHub Account

  • Go to github.com
  • Click Sign up
  • Use your personal email if possible (since you may want to use this account after you leave UK)
    • Whatever you choose, you’ll need to use the same e-mail address for all Git steps
  • Choose a short, professional username (it doesn’t have to be completely vanilla, mine is Winjapati)

Configuring Git

Step 1: open the Terminal / Git Bash

  • You must set your info in a command prompt

    • Windows: Open the program called “Git Bash” (installed with Git)

    • Mac: Open the program called “Terminal” (in Applications → Utilities)

    • It looks like a scary black window. Don’t worry — you only need to type a few lines.

Step 2: Tell Git Your Name

  • Type this (replacing Your Name with your real name):
git config --global user.name "Your Name"
  • Press Enter
  • Nothing will happen, which is normal.

Step 3: Tell Git Your Email

  • Type this (use the email you signed up for GitHub with):
    • Replace your_email@example.com with your actual e-mail.
    • You must use the e-mail address you used to sign up on GitHub.
git config --global user.email "your_email@example.com"
  • Press Enter
  • Nothing will happen, which is normal.

Step 4: Make Sure it Worked

  • Type:
git config --list
  • You should see something like:
user.name="Jane Doe"
user.email=janedoe@email.com

Step 5: Create an SSH Key

  • An SSH key is a pair of files:

    • Private key (stays on your computer)
    • Public key (you upload to GitHub)
  • After setup, you won’t need to type passwords for pushes.

Step 5: Create an SSH Key

  • Open Git Bash (Windows) or Terminal (Mac)
  • Run the following code, using your actual e-mail address:
ssh-keygen -t ed25519 -C "your_github_email@example.com"
  • When asked “Enter a file in which to save the key,” press Enter (accept default ~/.ssh/id_ed25519).
    • “This creates two files in a hidden folder called .ssh inside your home directory.”

Step 5: Create an SSH Key

  • When asked for a passphrase, you can:

    • Press Enter for none (simplest; this is what I do), or
    • Type a passphrase (more secure; you’ll unlock it once per session).
  • You should see messages about creating id_ed25519 and id_ed25519.pub.

Step 5: Create an SSH Key

  • We now need to add this SSH key to our systems
  • Run this code on Windows (Git Bash):
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519
  • On Mac (Terminal):
eval "$(ssh-agent -s)"
ssh-add --apple-use-keychain ~/.ssh/id_ed25519
  • If you get a permissions error, raise your hand — we’ll fix it together.

Step 5: Create an SSH Key

  • Copy the public key to clipboard

  • Windows (Git Bash):

clip < ~/.ssh/id_ed25519.pub
  • Mac (Terminal)
pbcopy < ~/.ssh/id_ed25519.pub

Step 6: Add the key to GitHub

  • Go to GitHub → Settings → SSH and GPG keys → New SSH key
  • Title: “Laptop” (or something you’ll recognize)
  • Key type: Authentication
  • Key: paste the clipboard contents
  • Save.

Step 7: Test the Connection

  • Back in the Git Bash / Terminal:
ssh -T git@github.com
  • The first time, you’ll be asked to trust GitHub — type yes.
  • Success looks like: “Hi your-username! You’ve successfully authenticated…”

Linking RStudio & GitHub

Creating a Repository

  • On GitHub:
    • New repository → call it LIN_301
    • Choose “Public”
    • Add a README.md file

Linking that Repository with RStudio

  • File → New Project → Version Control → Git
  • Paste repo URL
  • Clone it

Testing the Two

  • In RStudio, click on “README.md” and edit the file.
  • At the top right of your RStudio window, select Git → Commit
  • Make sure the staged box has a check mark
  • Write a commit message, then press commit. A box will pop up, close it.

This is Crucial!

You must select push to send your changes to the GitHub server.

Troubleshooting

  • If your RStudio is asking you to supply a username and PAT, even if you’ve followed all of the steps correctly above, use this code:
git remote -v   # you’ll likely see https://github.com/...
# replace with SSH:
git remote set-url origin git@github.com:<YourUser>/<YourRepo>.git

# double check:
git remote -v   # now it should show git@github.com:...
  • After following these steps, try to push your file to the Git server.

In Case of Emergency, Make PAT

Create a PAT

  • Go to:
    • GitHubSettingsDeveloper settingsPersonal access tokensTokens (classic)
  • Click Generate new token
    • Give it a name: laptop-rstudio
    • Expiration: pick something reasonable (e.g. 90 days)
    • Scopes: check repo (read & write)
  • Click Generate
    • Copy the token immediately — you won’t see it again.
    • It looks like: ghp_abCDefGhijKlmnOPqRstUvWxYz1234567890