Repository navigation
1‐1 Setup Tasks
In this activity, you will set up your course development environment (CDE). Complete these one-time setup tasks before the end of Week 1 or before starting Repository Activities.
Complete these setup steps in order.
- Set up your GitHub account
- Set up the STEM Computing Baseline
- Set up your development tools
- Set up your course repository
- Temporary Holding Area
Start at the step that best describes your situation:
-
Create a GitHub account: I don't have a GitHub account.
-
Configure your GitHub account: I already have a GitHub account, but haven't set it for up for SNHU coursework yet.
-
Verify your GitHub account: I already set up my GitHub account for SNHU coursework.
Start at the step that best describes your situation:
-
Install the SCB: I have never installed the STEM Computing Baseline (SCB) on this computer. Follow the instructions for your operating system:
-
Configure the SCB: I have installed the STEM Computing Baseline (SCB) on this computer but have not configure it for use. Follow the instructions for your operating system:
-
Verify the SCB: I have already installed the STEM Computing Baseline (SCB) on this computer and want to ensure it is correctly set up.
Copy and run the following command block to a terminal in your CDE. For help using a terminal, see Terminal Basics.
cd "$HOME/Repos" bash --version pwsh --version git --version gh --version python -c "import sys; assert sys.version_info[:2] >= (3, 12), 'Python 3.12 or newer is required'; print(sys.version)" code --version git config --show-origin --get-regexp '^user\.(name|email)$' gh auth status
Expected output: The command block should display the versions of Bash, PowerShell, Git, GitHub CLI, Python, and VS Code, as well as your Git user configuration and GitHub authentication status.
After installing and configuring the SCB, check whether you already have a crs000 repository. An accidental fork can be recovered without deleting your Git history. Do not fork the course repository: forks of the public course repository are public and cannot be made private while they remain forks.
Run the following commands in a Bash terminal (Git Bash on Windows).
gh auth status --active --hostname github.com
gh api --hostname github.com user --jq '{login, type}'Confirm that login is your personal GitHub username and type is User. Use this same account in your browser. If you are not signed in, run gh auth login --hostname github.com --git-protocol https --web. If a different saved account is active, run gh auth switch --hostname github.com --user YOUR-USERNAME, replacing YOUR-USERNAME with your username. Then repeat the check. Stop if authentication fails or the account is incorrect.
This check reads your account and repositories; it does not change them. Copy the entire block, including the parentheses.
(
set -e
course_user=$(gh api --hostname github.com user --jq 'select(.type == "User") | .login')
[ -n "$course_user" ] || { echo "Stop: a personal GitHub account is required."; exit 1; }
echo "Checking $course_user/crs000"
course_repo=$(gh api --hostname github.com --paginate 'user/repos?affiliation=owner&per_page=100' --jq '.[] | select((.name | ascii_downcase) == "crs000") | .full_name')
if [ -z "$course_repo" ]; then
echo "No crs000 repository was found in this account."
else
gh api --hostname github.com "repos/$course_repo" --jq '{repository: .full_name, fork, private, parent: .parent.full_name, source: .source.full_name}'
fi
)| Result | What to do |
|---|---|
No crs000 repository found |
Continue to Set up your development tools. You will create your private repository later. |
fork: false, private: true
|
Keep this independent private repository and its work. Continue to Set up your development tools; reuse it later. |
fork: false, private: false
|
If this is your course repository, follow Make your independent repository private. If it is unrelated work, ask your instructor before changing it. |
fork: true, with GC-STEM/crs000 as parent or source
|
Follow Recover an accidental fork. |
| A different fork source, an error, or unexpected output | Stop and ask your instructor for help. Do not delete or replace anything. |
A failed request is not evidence that a repository is absent. If you can see a private crs000 repository in your browser but this check cannot find it, resolve the account or CLI access problem before continuing. The CLI must be allowed to access your private repositories.
Complete this part only for your personal fork of GC-STEM/crs000. Keep its name crs000 so you can reuse it throughout these setup tasks.
-
Preserve your work first. Save open editor files, then copy any existing local course folder to a separate backup location, including hidden files such as
.gitand any uncommitted or untracked work. Do not delete or replace your existing folder. -
Back up the fork's Git history, including its branches and tags, with the block below. If the backup folder already exists, stop and keep it; ask your instructor to help choose another backup location. This backup does not include GitHub issues, pull requests, or other website information. If you need that information or use Git LFS, ask your instructor to help back it up before proceeding.
( set -e course_user=$(gh api --hostname github.com user --jq 'select(.type == "User") | .login') [ -n "$course_user" ] || exit 1 mkdir -p "$HOME/Repos" [ ! -e "$HOME/Repos/crs000-fork-backup.git" ] || { echo "Stop: keep the existing backup folder."; exit 1; } git clone --mirror "https://github.com/$course_user/crs000.git" "$HOME/Repos/crs000-fork-backup.git" )
-
Continue only after the backup succeeds. In your browser, open your
crs000repository. Check that its owner is your personal username and that it belongs to the course fork network. -
Read GitHub's fork-detachment guidance. Detachment is permanent. Git commits are retained, but repository metadata such as issues, pull requests, wikis, stars, and comments is lost. Review GitHub's complete warnings before deciding to proceed.
-
For an eligible fork—public, smaller than 1 GB, with no child forks—open Settings → General → Danger Zone → Leave fork network. Acknowledge the effects, enter the fork's name when prompted, and confirm. Wait for GitHub to finish.
-
Continue with Make your independent repository private below. Detaching alone does not make the repository private.
Use GitHub's website for detachment. Neither Git nor the GitHub CLI provides a Leave fork network command. Changing a local Git remote does not detach a GitHub fork.
If the option is unavailable or you need to preserve website metadata: stop and contact your instructor. Keep the fork, backup, and local work intact. Your instructor can help arrange an independent private copy or seek GitHub Support guidance. GitHub also documents a manual clone/delete/recreate method; because that deletes the fork and associated information, do not use it as an automatic recovery step.
Use this part for a detached fork or an existing independent public course repository. First, repeat Find your existing repository and confirm that the correct personal repository now reports fork: false. If it still reports true or any check fails, stop.
Review GitHub's visibility-change consequences before running this block. It refuses to change a repository that is still a fork.
(
set -e
course_user=$(gh api --hostname github.com user --jq 'select(.type == "User") | .login')
[ -n "$course_user" ] || exit 1
course_repo="$course_user/crs000"
independent=$(gh api --hostname github.com "repos/$course_repo" --jq '.fork == false')
[ "$independent" = true ] || { echo "Stop: the repository is still a fork."; exit 1; }
gh repo edit "https://github.com/$course_repo" --visibility private --accept-visibility-change-consequences
gh api --hostname github.com "repos/$course_repo" --jq '{repository: .full_name, fork, private}'
)Confirm fork: false and private: true before continuing. If the CLI does not recognize the visibility flag or cannot make the change, use your repository's Settings → General → Danger Zone → Change repository visibility → Make private, then repeat the check. Ask your instructor if either method fails. Making a repository private cannot recall copies of work that were already public.
{{SME TODO: Add overview of available course development environments. }}
Install and configure the development tools on your own computer. You must have a publisher-supported version of your operating system and access to an administrator account to approve installations when required. You do not need to use an administrator account for your coursework after completing the setup.
Use {{remote development environment}}, the {{recommended | required}} development environment for this course. It serves as the reference environment for course instructions and examples.
Development tools are pre-installed. You just need to configure some personal settings.
Use browser-based development tools with no installation. These options are useful if you join the course late, need to get started quickly, or cannot install software on your device (such as a work or library computer, Chromebook, or tablet).
These tools are generally better for temporary or occasional use than regular coursework. For long-term use, choose your course's recommended development environment.
-
GitHub Codespaces — A full cloud development environment for writing, running, testing, and debugging code, including terminal access. Monthly usage limits apply.
-
VS Code for Web — A free browser-based code editor for editing files and saving changes to GitHub. Cannot run or debug code or execute terminal commands. No usage limits.
A GitHub repository stores your course files and tracks changes to them. In this phase of the setup tasks, you will create or reuse two connected copies: one
- In your course development environment (CDE)
- In your personal GitHub account.
Run the following commands in a Bash terminal (Git Bash on Windows).
Cloning a repository copies its files and history to your computer or virtual desktop. Your local copy will remain connected to the official course repository through a remote named upstream, allowing you to receive course updates.
Choose one path:
-
You already have a local
crs000folder: keep and reuse it. Open a Bash terminal in that folder and rungit statusandgit remote -v. Keep uncommitted and untracked files. If it is not a Git repository, is unrelated to this course, or is in a different location from$HOME/Repos/crs000, ask your instructor to help adapt these instructions. Do not clone over it or delete it. -
You have no local folder, but already have an independent private
crs000repository: clone your personal repository with the block below. This brings down your existing work. Do not use the new-repository block after it.( set -e course_user=$(gh api --hostname github.com user --jq 'select(.type == "User") | .login') [ -n "$course_user" ] || exit 1 ready=$(gh api --hostname github.com "repos/$course_user/crs000" --jq '.fork == false and .private == true') [ "$ready" = true ] || { echo "Stop: complete the repository recovery check first."; exit 1; } mkdir -p "$HOME/Repos" git clone "https://github.com/$course_user/crs000.git" "$HOME/Repos/crs000" )
-
You have neither a local folder nor a GitHub
crs000repository: run the following original-course clone block.
mkdir -p "$HOME/Repos"
git clone --origin upstream https://github.com/GC-STEM/crs000.git "$HOME/Repos/crs000" &&
cd "$HOME/Repos/crs000" &&
git remote -vUse the GitHub CLI to create a private repository in your personal GitHub account, or reconnect the independent private repository you already have. This repository belongs to you and will store your coursework indefinitely. Do not create a second repository or delete an existing one.
Git connects your local copy to your personal repository on GitHub through a remote named origin. You will use origin to save your work to GitHub and upstream to receive official course updates.
Repeat the earlier account and repository checks if you have changed terminals or signed in again. Then review the current folder and remotes:
cd "$HOME/Repos/crs000" &&
git status &&
git remote -vThe following block creates crs000 only when the account listing confirms it is absent. It then checks that the repository is independent and private, and connects origin to your personal repository and upstream to GC-STEM/crs000. It accepts the usual HTTPS or SSH URLs for these two repositories. If an existing remote points somewhere else or has custom push settings, it stops so your instructor can help preserve that configuration.
(
set -e
cd "$HOME/Repos/crs000"
repo_prefix=$(git rev-parse --show-prefix)
[ -z "$repo_prefix" ] || { echo "Stop: this folder is not the repository root."; exit 1; }
course_branch=$(git symbolic-ref --quiet --short HEAD)
course_user=$(gh api --hostname github.com user --jq 'select(.type == "User") | .login')
[ -n "$course_user" ] || exit 1
course_repo="$course_user/crs000"
personal_url="https://github.com/$course_repo.git"
official_url="https://github.com/GC-STEM/crs000.git"
if git config --get-regexp '^remote\.(origin|upstream)\.(pushurl|push|mirror)$'; then
echo "Stop: ask your instructor to review the custom push settings."
exit 1
fi
for remote in origin upstream; do
if git remote | grep -qx "$remote"; then
remote_url=$(git remote get-url --all "$remote")
case "$remote:$remote_url" in
origin:"$personal_url"|origin:"https://github.com/$course_repo"|origin:"git@github.com:$course_repo.git") ;;
origin:"$official_url"|origin:"https://github.com/GC-STEM/crs000"|origin:"git@github.com:GC-STEM/crs000.git") ;;
upstream:"$official_url"|upstream:"https://github.com/GC-STEM/crs000"|upstream:"git@github.com:GC-STEM/crs000.git") ;;
*) echo "Stop: ask your instructor to review $remote ($remote_url)."; exit 1 ;;
esac
fi
done
existing_repo=$(gh api --hostname github.com --paginate 'user/repos?affiliation=owner&per_page=100' --jq '.[] | select((.name | ascii_downcase) == "crs000") | .full_name')
if [ -z "$existing_repo" ]; then
GH_HOST=github.com gh repo create "$course_repo" --private
fi
ready=$(gh api --hostname github.com "repos/$course_repo" --jq '.fork == false and .private == true')
[ "$ready" = true ] || { echo "Stop: complete the repository recovery check first."; exit 1; }
if git remote | grep -qx origin; then
git remote set-url origin "$personal_url"
else
git remote add origin "$personal_url"
fi
if git remote | grep -qx upstream; then
git remote set-url upstream "$official_url"
else
git remote add upstream "$official_url"
fi
git config remote.pushDefault origin
git config "branch.$course_branch.pushRemote" origin
git remote -v
git fetch origin
git push --set-upstream origin HEAD
)Expected result: origin points to https://github.com/YOUR-USERNAME/crs000.git and upstream points to https://github.com/GC-STEM/crs000.git. Your current branch is uploaded to your private repository. Uncommitted and untracked files stay in your local folder; they are not uploaded by git push.
If the push is rejected because the GitHub copy contains different commits, keep both copies and ask your instructor to help reconcile them. Do not force-push, reset, or delete files to get past the error. If any command fails, resolve the error before continuing.
After a successful upload, star the official course repository and verify the final state:
(
set -e
course_user=$(gh api --hostname github.com user --jq 'select(.type == "User") | .login')
[ -n "$course_user" ] || exit 1
gh api --hostname github.com --method PUT user/starred/GC-STEM/crs000
gh repo view "https://github.com/$course_user/crs000" --json nameWithOwner,isFork,isPrivate
git -C "$HOME/Repos/crs000" remote -v
)GitHub is also a social network where you can share ideas, explore projects, and learn from others. GC-STEM is SNHU's official GitHub organization for its online STEM degree programs, offering opportunities to connect with faculty and fellow students.
Run the following commands to follow GC-STEM. You'll see its public activity, including new repositories and discussions, on your GitHub dashboard.
cd "$HOME/Repos/crs000"
gh api graphql -f query='mutation($id:ID!){followOrganization(input:{organizationId:$id}){id}}' -f id="$(gh api orgs/GC-STEM --jq .node_id)"code "$HOME/Repos/crs000"Important
Now that you have completed setting up your platform, perform all remaining activities in your course development environment (CDE), not on GitHub.
Wiki Home · Code Repository · Ask a Question · Report an Issue
Maintained by GC STEM.