Beginner's Guide: How to Authenticate Your Mac to GitHub
Tutorials

October 9, 2024
Beginner's Guide: How to Authenticate Your Mac to GitHub
Step 1: Create a GitHub Account
- Go to github.com
- Click "Sign up"
- Follow the instructions to create your account
Step 2: Install Git on Your Mac
- Open Terminal (find it in Applications > Utilities)
- Type this command and press Enter:
git --version - If Git is not installed, you'll be prompted to install it
Step 3: Set Up Git
In Terminal, set your name and email:
git config --global user.name "Your Name"
git config --global user.email "your_email@example.com"
Step 4: Check for Existing SSH Keys
- In Terminal, type:
ls -al ~/.ssh - Look for files named
id_rsa.pub,id_ecdsa.pub, orid_ed25519.pub - If you see any of these, you already have SSH keys
Step 5: Generate an SSH Key (if needed)
If you don't have existing keys or want to create new ones:
- In Terminal, type:
ssh-keygen -t ed25519 -C "your_email@example.com" - Press Enter to accept the default file location
- You can set a passphrase for extra security or press Enter twice for no passphrase
Step 6: Add SSH Key to GitHub
- Copy your SSH key to clipboard:
- For new keys:
pbcopy < ~/.ssh/id_ed25519.pub - For existing keys:
pbcopy < ~/.ssh/id_rsa.pub(or the name of your existing public key)
- For new keys:
- Go to GitHub.com and log in
- Click your profile photo > Settings
- Click "SSH and GPG keys" in the sidebar
- Click "New SSH key"
- Give your key a title (e.g., "My Mac")
- Paste your key into the "Key" field
- Click "Add SSH key"
Step 7: Test Your Connection
In Terminal, type:
ssh -T git@github.com
If successful, you'll see a message like "Hi username! You've successfully authenticated..."
Congratulations! You're now authenticated to use GitHub from your Mac, either with your new or existing SSH keys.