If you haven’t set up Git and GitHub yet, complete the Git & GitHub Setup tutorial first.
If you have done this, you already know why we use Git and GitHub. Now let’s walk through exactly how to start using them for your project.
Create the repository on GitHub
Go to the WWS GitHub organization.
Click the green New repository button (top right).
Name your repo using the format:
WWS-Node#-ProjectCode-ProjectKeywords where:
# is the node numberProjectCode is a short (<5 letter) acronym for the
projectProjectKeywords describe what the project is about in a
few wordsAdd a brief description (what the project is about).
Choose Public or Private. (Private = only visible within WWS organization.)
Check “Initialize with a README.” This will be your repo’s welcome page with links, notes, and contact info.
(Optional) Add a .gitignore or license — skip if
unsure (you can add later).
Click the green Create repository button.
Clone the repo to your computer
CTRL + SHIFT + O)Choose your repo from the list.
Choose where to save it locally. It’s highly recommended to save your repo on your local (C) drive.
Check your local folder
If using R, make it an R Project
Why: R Projects make your data/code portable and keep file paths consistent across computers.
In RStudio, run:
#install.package("usethis") #only need to run the first time
library(usethis)
#the location you of your project folder
local_dir <- "Z:/1_Research/7_WWS/WWS-Node1-MCDOM"
#create a project from the directory
usethis::create_project(local_dir)Store all project files here
If your project already exists locally and you want to start tracking it in GitHub:
(Optional but recommended) Make it an R Project
#install.package("usethis") #only need to run the first time
library(usethis)
#the location you of your project folder
local_dir <- "file path to project folder"
#create a project from the directory
usethis::create_project(local_dir)Initialize Git in the project
usethis::use_git()Add to GitHub Desktop
CTRL + O)Select your project folder and click Add Repository.
You’ll now see your files listed in GitHub Desktop.
Publish the repo to GitHub
In GitHub Desktop, click Publish repository (top right).
Name your repo using the format:
WWS-Node#-ProjectCode-ProjectKeywords where:
# is the node numberProjectCode is a short (<5 letter) acronym for the
projectProjectKeywords describe what the project is about in a
few wordsClick Publish repository (blue button).
Make your first commit & push
In GitHub Desktop, all files will be checked (or staged) by default.
Add a commit message (for your first commit, “Initial commit” is common).
Click Commit.
Click Publish branch (top right) to send your files to GitHub.
Check your repo online
Hester, J. B., the STAT 545 TAs, Jim. (n.d.). Happy Git and GitHub for the useR
How to Create Your First GitHub Repository: A Beginner’s Guide (2024). YouTube video