This document provides a workflow for creating and contributing to a new GitHub repository, specifically a repository in the NC State Libraries Data & Vis Organization, using the Git command line tool or the application GitHub Desktop.
- A GitHub account (If you do not have an account, create one through the join GitHub page).
- Membership to the NC State Libraries Data & Vis Organization (Email Joddy or Shannon to receive an invitation).
- Git (Git Download page) OR GitHub Desktop (GitHub Desktop download page).
- Setting up a personal access token (PAT) for authentication and login (Creating a personal access token).
The following instructions walk through the process of creating a new GitHub repository in the NC State Libraries Data & Vis Organization. If you want to contribute to an existing repository you can skip to Step 2a, or Step 2b for instructions on using Git in the terminal or GitHub Desktop.
-
In a browser, navigate to the NC State Libraries Data & Vis Organization.
-
Click the button labeled New in the upper-right corner.
-
On the Create a new repository page the default owner should be set to ncsu-libraries-data-vis.
-
Create a new repository name:
-
The name should be short (approximately five words or less) and descriptive.
-
Separate each word with a dash (-).
For example:
The workshop "An Introduction to Programming with Python" has the repository name introduction-to-programming-with-python.
-
-
Add a short description of the repository (approximately one to two sentences).
For example:
The workshop "An Introduction to Programming with Python" has the description These materials introduce fundamental concepts of programming through the Python programming language.
-
In most cases, the repository should be set to public–anyone on the internet can see the repository but cannot automatically commit.
-
Initialize the new repository with:
-
A README file (This file will eventually contain an in depth description of the repository materials.)
-
If the repository will consist of software, a License file (From the license options select MIT License. The copyright attribution on line 3 of this file,
Copyright (c) 2021 NC State Libraries Data & Vis
, should eventually be edited to:Copyright (c) 2021 NC State University
)If the new repository will consist of instructional materials, skip creating a LICENSE file. Instead, manually create a LICENSE file and add copy the Creative Commons Attribution 4.0 International license language contained in the LICENSE file within this repository.
-
If using a specific language/tool, a .gitignore file using the appropriate provided template.
For example:
The workshop "An Introduction to Programming with Python" uses the Python template.
If there is not an appropriate template for the new repository, skip creating a .gitignore file. A .gitignore files should eventually be created in the root folder of the repository. A good base .gitignore configuration example is available in "Some common .gitignore configurations". You can also explore this collection of .gitignore templates for a relevant template for your materials (e.g., there is a template for Microsoft Office for PowerPoint, Excel, etc.).
-
-
Click the button labeled Create repository
- In Github, navigate to your repository.
- Click on the green "Code" button in the top right.
- Select "Open with GitHub Desktop."
- In the GitHub Desktop app, select a local path.
You are creating a copy of the repository on your machine to edit, so choose a local path that makes sense for you (for example: a folder that stores all of your GitHub repositories).
- Click the blue "Clone" button.
- Access the instruction materials on your computer.
If you are transferring materials from a shared Drive, this may mean downloading the entire folder for the workshop materials and unzipping them.
- Move the folder of downloaded materials into the folder you chose earlier for your local path. This will move the materials into your local copy of the repository.
- In GitHub desktop, you should now see in the left pane that there are changed files (the ones you just moved).
- Commit to the main branch
- At the bottom left, write a short title for your commit and an optional description.
- Click on the blue "Commit to main" button
- Push commits to the origin.
- At the top toolbar, the right-most box should now give you the option to "Push origin," click on that box to push.
- Alternatively, in the right pane, you should now see the option to push commits to the origin remote.
- Click the blue "Push origin" button.
- Before editing, fetch the most recent changes and check to make sure you are in the right branch.
- Check your branch and create new branches in the middle dropdown of the UI called "Cuurent branch."
- Click the rightmost box in the top toolbar that says "Fetch origin"
This will make your local copy match the one in the GitHub repository. If you have changes that you have not pushed, this may cause a conflict.
- Make your edits as usual and save to the same file.
- In GitHub desktop, you should now see in the left pane that there are changed files (the ones you just moved).
- Commit to the main branch
- At the bottom left, write a short title for your commit and an optional description.
- Click on the blue "Commit to main" button
- Push commits to the origin.
- At the top toolbar, the right-most box should now give you the option to "Push origin," click on that box to push.
- Alternatively, in the right pane, you should now see the option to push commits to the origin remote.
- Click the blue "Push origin" button.