Setup
Setting up Git and GitHub
- Create a GitHub account
- Install GitHub Desktop - Note that this will also install Git on your machine
- Request access to NMFS GitHub Enterprise Cloud (NMFS staff and affiliates only)
- Download the NMFS GitHub Enterprise Cloud user agreement
- Use this Google form to request access to Enterprise
- Wait for follow-up email and confirm you’re a member (if you see a 404 page you haven’t been added yet)
- Log into GitHub and GitHub Desktop using your GitHub account credentials
Signing up for GitHub Enterprise Cloud (GHEC)
Follow the instructions on the GGT website to request access.
Wait to be invited to GHEC and accept
Then you can sign in to an org like https://github.com/noaa-nwfsc with CAC or password+authentication
Authenticating to GHEC
Using GitHub Desktop
Go to GitHub Desktop > Settings > Accounts
Sign into GitHub.com. Ignore GitHub Enterprise!!
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
In RStudio, Tools > Terminal > New Terminal
At the command line (in the new terminal), type
which git
if on a Mac andwhere git
if in Windows.Copy that path.
In RStudio, Tools > Global Options > Git/SVN There is a box at top that asks for the location of the Git binary.
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
Install
usethis
R packageRun 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
Set the date when the token will expire.
Scroll to bottom and click “Generate token”
Copy the long PAT.
Authenticating to GHEC: Using RStudio
Configure PAT for GHEC
Next to the PAT, you will see “Configure for SSO”.
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)