Setup

Setting up Git and GitHub

  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

Signing up for GitHub Enterprise Cloud (GHEC)

Authenticating to GHEC

Using GitHub Desktop

  1. Go to GitHub Desktop > Settings > Accounts

  2. Sign into GitHub.com. Ignore GitHub Enterprise!!

  3. DONE!

Authenticating to GHEC

Using GitHub Desktop

Help! I signed up for GitHub Enterprise and GitHub Desktop will not authenticate!! Log out of GitHub Desktop under GitHub Desktop > Settings (or Options) > Account and log back in.

Authenticating to GHEC: Using RStudio

Tell RStudio about Git

  1. In RStudio, Tools > Terminal > New Terminal

  2. At the command line (in the new terminal), type which git if on a Mac and where git if in Windows.

  3. Copy that path.

  4. In RStudio, Tools > Global Options > Git/SVN There is a box at top that asks for the location of the Git binary.

  5. Paste that path in.

Authenticating to GHEC: Using RStudio

You have to authenticate to GitHub separately for RStudio even if you are signed in on GitHub Desktop.

If you see anything like this, you have not authenticated.

Authenticating to GHEC: Using RStudio

Set up

  1. Install usethis R package

  2. Run this code:

usethis::use_git_config(user.name = "your username", user.email = "you@noaa.gov")

Authenticating to GHEC: Using RStudio

Create Token

usethis::create_github_token(   scopes = c("repo", "workflow"),   description = "DESCRIBE THE TOKEN'S USE CASE",   host = NULL )

Authenticating to GHEC: Using RStudio

Create Token

  1. Set the date when the token will expire.

  2. Scroll to bottom and click “Generate token”

  3. Copy the long PAT.

Authenticating to GHEC: Using RStudio

Configure PAT for GHEC

  1. Next to the PAT, you will see “Configure for SSO”.

  2. Click that and authenticate to your GHEC org

Authenticating to GHEC: Using RStudio

Tell RSTudio about the PAT

Run this code.

credentials::set_github_pat("THE LONG PAT)