Source: GitHub Basics — Connected Objects

Note: raw/GitHub basics — Connected Objects 1.md is identical to this file.

Branch Management

git status                  # verify you are on instructions branch
git switch -c lab-1         # create new branch
git push -u origin          # push branch to remote
git status                  # verify up-to-date

GitHub Authentication

Since July 2021, GitHub no longer accepts account passwords for git operations.

Use a Personal Access Token (PAT) — classic (not fine-grained), with repo scope at minimum.

Token format: ghp_<long string>

Storing PAT with pass (password manager)

Setup gpg key (required by pass)

gpg --full-generate-key
# Recommended: RSA, 4096 bits, no expiry, match name/email to GitHub

Export public key for GitHub:

gpg --armor --export | clip.exe   # WSL
gpg --armor --export | pbcopy     # macOS

Add to GitHub: Settings → SSH and GPG keys → New GPG key

Initialize pass and store token

pass init <email-used-for-gpg-key>
pass insert github/token           # paste token when prompted
pass github/token                  # retrieve
pass github/token | clip.exe       # copy to clipboard

Troubleshoot: “No secret key”

gpg -k                                    # list your gpg keys
cat ~/.password-store/.gpg-id             # check which key encrypts pass
gpgconf --kill gpg-agent                  # restart gpg agent
# If still failing: wsl --shutdown <distro-name> in PowerShell, then retry

See Also