Appendix E — GitHub Configuration
GitHub hosts remote repositories and provides collaboration features, but your local Git installation needs to authenticate with GitHub to push and pull. This appendix covers creating a GitHub account, authenticating securely, and setting up the GitHub CLI for streamlined workflows.
Creating a GitHub Account
If you don’t have a GitHub account, create one at github.com/signup. Choose a professional username since it becomes part of your repository URLs and identifies you in contributions to open-source projects.
When selecting a username, consider using your real name or a professional handle, avoid numbers or characters that make the name hard to remember, and keep it consistent with your other professional accounts.
After creating your account, verify your email address by clicking the link GitHub sends. This is required for many GitHub features to work properly.
Authentication Methods
Git needs to prove your identity when pushing to or pulling from private repositories on GitHub. There are two main authentication methods: HTTPS with the GitHub CLI, and SSH keys.
Recommended: GitHub CLI Authentication
The GitHub CLI (gh) is the simplest way to authenticate. It handles credential storage automatically and integrates Git operations with GitHub features.
Install the GitHub CLI:
On Windows with WinGet:
terminal
winget install GitHub.cliOn macOS with Homebrew:
terminal
brew install ghAfter installation, close and reopen your terminal, then verify:
terminal
gh --versionAuthenticate with GitHub:
terminal
gh auth loginThe CLI walks you through the authentication process interactively. When prompted, select GitHub.com (unless you use GitHub Enterprise). Choose HTTPS as the preferred protocol for Git operations. When asked about authenticating Git with your GitHub credentials, select Yes. Select Login with a web browser (this is the most secure option).
The CLI generates a one-time code and opens your browser. Log in to GitHub if needed, enter the code, and authorize the GitHub CLI. Back in your terminal, you’ll see confirmation that authentication succeeded.
Verify your authentication:
terminal
gh auth statusoutput
github.com
✓ Logged in to github.com as your-username (oauth_token)
✓ Git operations for github.com configured to use https protocol.
✓ Token: gho_************************************
Now Git operations to GitHub will authenticate automatically.
Configuring Your GitHub Profile
Your GitHub profile represents you professionally. Take time to complete it.
Navigate to Settings → Profile and add a professional profile photo (your face, not a logo or meme), a bio describing your role and interests, your location and organization (if appropriate), and links to your website or portfolio.
The profile README is a special feature: create a repository with the same name as your username (e.g., username/username), and its README appears on your profile page. This is a good place to highlight your skills and projects.
GitHub CLI Configuration
The GitHub CLI has configuration options beyond authentication.
View current configuration:
terminal
gh config listSet your default editor:
terminal
gh config set editor "zed --wait"Set the preferred Git protocol:
terminal
gh config set git_protocol https
# or
gh config set git_protocol sshSet the default browser:
terminal
gh config set browser "chrome"Essential GitHub CLI Commands
Once authenticated, the GitHub CLI streamlines many workflows. These are the commands you’ll use most frequently.
Create a repository:
terminal
# Create a new repository and push current directory
gh repo create my-project --public --source=. --remote=origin --push
# Create interactively
gh repo createClone a repository:
terminal
gh repo clone username/repo-nameView repository in browser:
terminal
gh repo view --webCreate a pull request:
terminal
gh pr create --title "Add feature X" --body "Description of changes"
# Create interactively
gh pr createList and view pull requests:
terminal
gh pr list
gh pr view 42
gh pr view 42 --web # Open in browserCheck out a pull request locally:
terminal
gh pr checkout 42Create an issue:
terminal
gh issue create --title "Bug in parser" --body "Steps to reproduce..."List and view issues:
terminal
gh issue list
gh issue view 123View your notifications:
terminal
gh statusNotifications and Watching
GitHub sends notifications for activity on repositories you watch. Managing notifications prevents inbox overload.
Access notification settings at Settings → Notifications. Configure whether to receive email notifications, participating notifications (when you’re mentioned or assigned), and watching notifications (all activity on watched repos).
For repositories, choose your watch level by visiting the repository and clicking “Watch.” Options include participating only (you’re mentioned or assigned), all activity, ignore, or custom selections.
Connecting Git and GitHub
Ensure your Git identity matches your GitHub account:
terminal
# Check your Git email
git config --global user.email
# This should match one of your GitHub emails
# Verify at: https://github.com/settings/emailsIf your Git email doesn’t match any GitHub email, commits won’t be linked to your GitHub account. Either add the email to GitHub or change your Git configuration.
Troubleshooting Authentication
“Permission denied” when pushing:
Verify you’re authenticated:
terminal
gh auth status“Repository not found” error:
This usually means you don’t have access. Verify the repository exists and you have permission. Check for typos in the URL. If it’s a private repository, ensure you’re authenticated.
Credential issues:
If Git asks for credentials repeatedly, your credential helper may not be configured. See Appendix D — Git Configuration for credential helper setup, or use gh auth setup-git to configure Git to use GitHub CLI authentication.
Summary
GitHub authentication connects your local Git to the remote platform. You learned how to create and configure a GitHub account, authenticate using the GitHub CLI (recommended) or SSH keys, configure the GitHub CLI for your workflow, and use essential CLI commands for repositories, pull requests, and issues. With authentication configured, you can seamlessly push your work to GitHub and collaborate with others.
Glossary
- GitHub CLI (gh)
- A command-line tool for interacting with GitHub, including authentication, repository management, pull requests, and issues.
- HTTPS Authentication
- Authentication using tokens or credentials over the HTTPS protocol. The GitHub CLI manages this automatically.
Resources
- GitHub CLI Documentation - Complete reference for
ghcommands - GitHub CLI Installation - Installation instructions for all platforms
- Creating a GitHub Account - Official account setup guide
- About GitHub and Git - Understanding the relationship between Git and GitHub