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.

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 list

Set 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 ssh

Set 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 create

Clone a repository:

terminal
gh repo clone username/repo-name

View repository in browser:

terminal
gh repo view --web

Create a pull request:

terminal
gh pr create --title "Add feature X" --body "Description of changes"

# Create interactively
gh pr create

List and view pull requests:

terminal
gh pr list
gh pr view 42
gh pr view 42 --web  # Open in browser

Check out a pull request locally:

terminal
gh pr checkout 42

Create 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 123

View your notifications:

terminal
gh status

Notifications 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/emails

If 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