Introduction to Git and GitHub

GitHub is an important platform for many NOAA Fisheries staff and teams to share and collaborate. In 2023, an Authorization To Use for GitHub Enterprise Cloud was signed, which provides a secure, private, access-controlled and managed platform for staff. In 2024, the GitHub Governance Team (GGT) provided a series of workshops to onboard NOAA Fisheries scientists to GitHub Enterprise and provide training in the use of Git and GitHub for NOAA Fisheries. In 2025, NMFS Open Science will be leading a second iteration of these workshops to provide NOAA Fisheries staff with the necessary skills to effectively incorporate Git and GitHub into existing workflows.

The GGT has outlined several use cases for why you may want to incorporate Git and GitHub into your workflows:

Aims and Objectives

This session will use a mixture of directed, interactive lessons and GitHub Skills to provide NOAA Fisheries staff with the knowledge required for basic repository management using Git commands, collaboration, and project management.

Prerequisites: What do I need before this workshop to follow along on my own?

  1. Create a GitHub account
  2. Install GitHub Desktop - Note that this will also install Git on your machine
  3. Request access to NMFS GitHub Enterprise Cloud (NMFS staff and affiliates only)
    1. Download the NMFS GitHub Enterprise Cloud user agreement
    2. Use this Google form to request access to Enterprise
    3. Wait for follow-up email and confirm you’re a member (if you see a 404 page you haven’t been added yet)
  4. Log into GitHub and GitHub Desktop using your GitHub account credentials

Why Git/GitHub?

GitHub Enterprise

Git and GitHub: The basics

Introduction to GitHub - Tutorial

GitHub Skills - Introduction to GitHub

We’ll be using the Introduction to GitHub Skills Tutorial to get our feet wet with Git and GitHub. Follow along with the tutorial using your personal GitHub account.

Step 1: Copy the exercise

Open the GitHub Skills link, and make sure you are logged into GitHub. Use the “Copy Exercise” button to make a new repository on your account:

When you open up the “Copy Exercise” link, you will be presented with the “Create a new repository” interface. Keep all of the defaults, and click the green “Create repository” button:

ImportantGitHub Skills tutorials use GitHub Actions in the background.

These actions use “minutes”, which are limited in a private repository, but unlimited in a public one. We suggest keeping your GitHub Skills tutorial repositories public to avoid any minutes limitations.

TipYou’ll notice that most steps in a GitHub Skills tutorial feature a message to wait about 20 seconds for the exercise to update.

GitHub Actions can take a little bit of time to run, so waiting this requisite time is important! Refresh the instructions after 20 seconds to make sure everything updates properly.

Step 2: Start the exercise

After waiting the suggested 20 seconds, refresh the instructions page. You’ll notice that the “Copy Exercise” button has switched from green to gray, and the “Start Exercise” button has switched from gray to green.

Right click the “Start Exercise” button and open it in a new tab. This will open an Issue for this repository that will serve as the instructions for the exercise.

TipI suggest moving the instructions tab into another window so you can work side-by-side with the instructions to limit switching back and forth between tabs.

Step 3: Follow the exercise

Create a new branch

Create a new branch following the instructions in the tutorial:

NoteIf you have the instructions open in side-by-side mode, you may notice that the github-actions bot will be producing new comments in the instructions.

Be sure to wait until the bot is finished before starting the next part of the exercise!

Create a commit with a new file

Click the “Add file” button to create a new file named PROFILE.md

TipIf you’ve arranged your screen in a side-by-side mode, the “Add file” button may look a bit different!

GitHub dynamically shortens certain buttons and tabs based on the size of the window. In this case, the “Add file” button becomes the “+” button:

Add a line to the new file, and click the “Commit changes” green button:

Change the “Commit message” to “Add PROFILE.md” and click “Commit changes” to confirm the commit

Open a pull request

Refresh the repository and click the “Compare & pull request” button.

Edit the title field to read “Add my first file”, and provide a brief description of your pull request. Click “Create pull request”

TipYou can follow the progress of the GitHub Actions running in the background after this step!

Merge the pull request

Click the green “Merge pull request” button, and confirm the merge. Delete the branch after merging (don’t worry, you can always restore a deleted branch)