Git/GitHub User Setup

How to contribute to the org and a basic Git/Github usage guide for the NW-PaGe Github Organization
Author

Frank Aragona

Published

February 1, 2023

Modified

March 10, 2025

Objectives

  • How to contribute to our GitHub repos
  • Steps to create a GitHub repo
  • Steps to clone a repo

You will need Git and Github to make code contributions:

Git Basics

Github Basics

Contributing

There are multiple ways to contribute to a Github repo, whether it is to report a bug, request a feature, or actively contribute to the code base.

To report a bug,

  1. click on a repo and click on the Issues tab.

  2. click the New issue button

  3. click on the Bug Report tab

From here you will need to fill out the bug report along with steps to reproduce the behavior you’re seeing.

Do you have a feature that you want included in the code base?

  1. click on a repo and click on the Issues tab.

  2. click the New issue button

  3. click on the Feature Request tab

From here you will need to fill out the feature request along with details

There is a discussions tab in our Github org. You can start discussions, ask questions, and share ideas here.

To contribute to a public repo in our Github org, please contact the repo owner to request read/write access. If you want to create a repo in the org, please contact frank.aragona@doh.wa.gov.

Before contributing any code, please read our security policies and collaboration guide. There you will find our repo rules and instructions on how to set up pre-commit hooks and contributing how to contribute code.

Once granted access, follow the steps below to create a repo (Section 5) and/or collaborate on code (?@sec-collab).

Create a Repo

Please see our tutorial for more details.

Once granted access to create a repo, you can go to our org and click Repositories > New repository or click here

This will take you to the Create a new repository screen. Please follow these instructions when filling it out:

Consider using a template unless you want to develop a repo from scratch. We have pre-built R, Python, and base templates that have Github Codespaces set up as well as .gitignore files and virtual environments.

Make sure the Owner name is NW-PaGe. Name your repository something descriptive and easy to type out. Avoid spaces and capital letters unless necessary.

The repo description can be filled out at any time after creating the repo

We don’t allow you to create a public repo initially. Please create a Private repo first, and then once you are ready to make it public you can.

  • Check the Add a README file box.
  • Add a .gitignore if the option is available (choose either R or Python)
  • Choose an MIT license unless you know you want a different license more info here

Cloning a Repo

Whether you have created your own repo or want to contribute to someone else’s repo, you will need to make a local clone of that repo on your personal machine.

To make a local clone of a repo, click on the green Code button when you’re in the main repo’s web page. In the local tab there are multiple ways to clone. For most of our work, I suggest creating an SSH key. If you are new to git/Github and on a Windows machine, I recommend installing the Github Desktop app and following the instructions below.

Cloning via HTTPS is a relatively quick process.

  1. Start by navigating to the repo in Github and selecting the Code button:

  1. Copy the path that starts with https://, in this case it’s https://github.com/NW-PaGe/standards.git

  2. In a terminal/command prompt, navigate to a folder of your choice (in windows I would make a folder called Projects here: C:/Users/<username>/Projects)

terminal
cd C:/Users/<your_username>/Projects
  1. Use git clone and replace the https://github.com/NW-PaGe/standards.git with your path:
terminal
git clone https://github.com/NW-PaGe/standards.git
  1. Check if things ran by executing this code:
terminal
git status

NOTE: the HTTPS method is good but it will require you to enter your username and a token every time you push a commit to the remote repo in Github. You will need to create a Personal Access Token (PAT) whenever you want to make a commit. If this is annoying to you, use the SSH or Github Desktop App methods.

Make a PAT

Here’s a guide on making a PAT

  1. Click on you Github profile icon in the upper right

  2. Click Settings

  3. Scroll down to Developer Settings

  4. Select Personal access tokens (classic) and then Generate new token

  5. When you make a commit you will need to input this personal access token when it asks for your password.

Do not store this token anywhere! Especially make sure it is not stored in your repo. This has tons of security risks and needs to be for singular use only

SSH is an excellent option for cloning a repo. It is similar to using an identifier to tell Github that you are, in fact, you. This video below is a great resource on how to set up the key. I will also write out the steps in the video below. Also, see the Github documentation for more information.

  1. In a terminal, write the following and replace the email with your email:
terminal
ssh-keygen -t ed25519 -C your@email.com
  1. It should then ask if you want to make a passphrase. I recommend doing this

  2. Get the pid

terminal
eval "$(ssh-agent -s)"
  1. Make a config file
terminal
touch ~/.ssh/config
  1. If the file doesn’t open, you can open it like this
terminal
nano ~/.ssh/config
  1. Add this to the config file. it will use your passkey and recognize you
ssh/config
Host *
  IgnoreUnknown AddKeysToAgent,UseKeychain
  AddKeysToAgent yes
  IdentityFile ~/.ssh/id_ed25519
  UseKeychain yes

To save this file in nano, on your keyboard write CRTL+O then ENTER to save the file. Then CTRL+X to exit back to the terminal. You can also open this file through a notepad or other software. You could also search for the file in your file explorer and edit it in notepad if that is easier.

  1. Add the identity
terminal
ssh-add ~/.ssh/id_ed25519
  1. In Github, go to your profile and the SSH + GPG Keys section

  2. Click SSH Keys, add a title, and in the key location write your key. You can find your key in your terminal by writing:

terminal
cat ~/.ssh/id_ed25519.pub

Copy the whole output including your email and paste it into the Github key location

  1. Test it by writing this:
terminal
ssh -T git@github.com
  1. Use the key to clone a repo.

Now you can clone a repo using the SSH key. Copy the SSH path and write this (replace the string after clone with your repo of choice):

terminal
git clone git@github.com:org/reponame.git

The GitHub CLI is an excellent tool for not just cloning your repo, but for managing repositories and organizations from a terminal.

To install the CLI in Windos, I follwed the instructions provided in the Github CLI repo.

I normally install commands using Scoop, but you have many options here.

  1. Paste this code into a powershell window and execute it
powershell
winget install --id GitHub.cli
  1. Now update the package
winget upgrade --id GitHub.cli
  1. You will need to authorize your github account like this:
gh auth login
  1. It will ask you to authorize in a browser or with a personal access token

I created a personal access token.

  1. Now you can clone a repo like this:
terminal
gh repo clone org/repo-name

You can also now do some cool things with your org/repo like searching for strings, creating issues, and more. For example, here are the issues in this repo:

terminal
gh issue list
output
Showing 3 of 3 open issues in NW-PaGe/standards

ID  TITLE                                      LABELS         UPDATED           
#7  add .gitignore documentation                              about 2 months ago
#3  Make sure all references are added to ...  documentation  about 5 months ago
#2  Fix cross reference links                  documentation  about 5 months ago

To install in a linux terminal, I’m following the instructions provided in the Github CLI repo.

  1. Paste this code into your bash terminal and execute it.
terminal
(type -p wget >/dev/null || (sudo apt update && sudo apt-get install wget -y)) \
&& sudo mkdir -p -m 755 /etc/apt/keyrings \
&& wget -qO- https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \
&& sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
&& sudo apt update \
&& sudo apt install gh -y
  1. Then upgrate the command with the code below
terminal
sudo apt update
sudo apt install gh
  1. You now need to authorize yourself as a user.
terminal
gh auth login
  1. It will ask you to authorize in a browser or with a personal access token

I created a personal access token. In linux there are some issues with the command and using a browser fyi.

  1. Now you can clone a repo like this:
terminal
gh repo clone org/repo-name

You can also now do some cool things with your org/repo like searching for strings, creating issues, and more. For example, here are the issues in this repo:

terminal
gh issue list
output
Showing 3 of 3 open issues in NW-PaGe/standards

ID  TITLE                                      LABELS         UPDATED           
#7  add .gitignore documentation                              about 2 months ago
#3  Make sure all references are added to ...  documentation  about 5 months ago
#2  Fix cross reference links                  documentation  about 5 months ago

If you’re new to Git or Github and are using a Windows machine, the GitHub Desktop app is a great option for managing git workflows.

  1. Install the app

  2. You will need to authenticate your account

  3. Now you should be able to clone repos through the app. In Github, when you click on the Code tab you will see the option to open in Github Desktop:

This will open up the desktop app and let you choose a file path for your Github repos. I recommend putting your repos into a Github or Projects folder in your local C drive, like this

  • C:/Users/yourname/Projects/<your-repo>/

If you’re cloning many repos you should put the repos into folders separated by the Github org

  • C:/Users/yourname/Projects/<gh-org-name>/<repo-in-org>/