GEN242: Data Analysis in Genome Biology
2026-04-07
Topics covered in this tutorial:
Note
This class makes heavy use of GitHub. Homework and course projects are submitted and graded via GitHub Classroom.
Tip
Git + GitHub together = local version control synced with a remote shared repository.
| OS | Command / Method |
|---|---|
| Windows | Installer from git-scm.com |
| macOS | brew install git or Xcode Command Line Tools |
| Linux (Debian/Ubuntu) | sudo apt install git |
| Linux (Fedora/RHEL) | sudo dnf install git |
Note
When using Git from RStudio, set the path to the Git executable under:
Tools → Global Options → Git/SVN
Practice in the browser (no install needed): try.github.io
git add myfile.txt # stage a specific file
git add . # stage all changes in current directory (recommended for daily use)
git add -A :/ # stage all changes in entire repo regardless of working directory| Command | Stages | Best for |
|---|---|---|
git add myfile.txt |
One file only | Selective, careful commits |
git add . |
All changes under current directory | Daily use — simple and intuitive |
git add -A :/ |
All changes in entire repo | Working inside a subdirectory |
For most workflows git add . is sufficient. Use git add -A :/ if you are working inside a subdirectory and want to be sure nothing elsewhere in the repo is missed.
Tip
List files to ignore (temp files, outputs) in a .gitignore file at the repository root. Regular expressions are supported — see GitHub docs.
Create the repository on GitHub first (leave README/license/.gitignore unchecked), then:
Warning
Do not initialize the GitHub repo with any files — that causes merge conflicts on the first push.
Private GitHub repositories (like your GEN242 homework repos) require SSH Key authentication. Password-based access is no longer supported by GitHub.
Step 1 — Generate a key pair on your machine (or on the HPCC cluster):
Step 2 — Display the public key and copy it:
Step 3 — Add it to GitHub:
Settings → SSH and GPG keys → New SSH key → paste → Save
Tip
For the HPCC cluster: generate the key pair on the cluster and upload ~/.ssh/id_rsa.pub to GitHub. See HPCC SSH Key docs.
SSH Key Workflow
Each computer that needs to push/pull from a private repo requires its own key pair. Upload each computer’s public key to GitHub separately.
Run this after creating your GitHub repository (see HW01 instructions):
# Clone the remote repository to your machine
git clone git@github.com:<user_or_org>/<repo_name>
cd <repo_name>
# Sync any remote changes
git pull
# Create a test file, stage, commit, and push
touch test
git add . # or: git add test to stage only this file
git commit -am "add test file"
git push
# Now edit 'test' directly on GitHub online, then pull the change back:
git pullFor users not yet comfortable with the command-line, GitHub supports browser-based uploads:
On your repository page click Add file → Upload files
In the file path field, type a subdirectory path and placeholder filename:
Homework/HW1/dummy.txtUpload your actual file to the newly created directory
Delete dummy.txt afterward
Note
GitHub does not display empty directories — the placeholder file trick creates the folder structure first so your real file has somewhere to land.
Tools → Global Options → Git/SVNFile → New Project → Version Control → Git → paste repository URL
Tools → Version Control → Commit
Tip
Useful RStudio keyboard shortcuts: support.rstudio.com
By default GitHub renders raw HTML source, not the page. Enable GitHub Pages to serve rendered HTML:
Settings → PagesDeploy from a branchmain, click SaveNote
The GEN242 course site itself is hosted this way via GitHub Pages.
Example repo: github.com/tgirke/View_HTML_on_GitHub
| Action | Command |
|---|---|
| Initialize repo | git init |
| Stage files | git add . or git add -A :/ |
| Commit changes | git commit -am "message" |
| Link to remote | git remote add origin <url> |
| Push to GitHub | git push |
| Pull from GitHub | git pull |
| Clone a repo | git clone <url> |
git pull # always sync first
# ... edit your files ...
git commit -am "your message" # commit locally
git push # push to GitHubNext: T2 — Linux & HPCC Cluster

GEN242 · UC Riverside · Tutorial source