In this lesson you will create a professional GitHub account, secure it with two-factor authentication, and connect your computer to GitHub with SSH keys, so you can push and pull without typing credentials.
📖 What You’ll Learn: creating and completing a GitHub profile, two-factor authentication, HTTPS vs SSH, generating an ed25519 SSH key, the SSH agent on every operating system, adding the key to GitHub, testing the connection and fixing common SSH errors.
👤 Step 1: Create Your GitHub Account
- Go to github.com and click Sign up.
- Enter your email, a strong password and a username.
- Verify your email address with the code GitHub sends you.
- Choose the Free plan. It includes unlimited public and private repositories.
💡 Tip: Choose your username carefully: it appears in your profile URL (github.com/your-username) and in every repository link you share with recruiters. Something like asha-verma-qa looks more professional than coolcoder99.
Complete your profile
- Add a photo, your name, a short bio (for example “QA Automation Engineer | Playwright | TypeScript”) and your location.
- Later, create a profile README by making a public repository with the same name as your username; its README appears on your profile page.
🛡️ Step 2: Turn On Two-Factor Authentication (2FA)
GitHub requires two-factor authentication for accounts that contribute code. Set it up early:
- Open Settings, Password and authentication.
- Enable 2FA with an authenticator app (Google Authenticator, Microsoft Authenticator, Authy) or a passkey.
- Download and store your recovery codes in a safe place. They are the only way back in if you lose your phone.
🔐 HTTPS or SSH? How Git Talks to GitHub
When you push or pull, Git must prove who you are. There are two connection types:
| HTTPS | SSH | |
|---|---|---|
| Remote URL | https://github.com/user/repo.git | git@github.com:user/repo.git |
| Authentication | Git Credential Manager (browser sign-in) or a personal access token | An SSH key pair on your computer |
| Setup effort | Very low on Windows and macOS | One-time key setup |
| Works through strict firewalls | Usually | Sometimes blocked (port 22) |
| Popular with | Beginners, Windows users | Developers, Linux users, CI servers |
Both are secure. Many developers use SSH so they never type credentials again. The rest of this lesson sets up SSH.
🗝️ Step 3: Check for Existing SSH Keys
Open Git Bash (Windows) or a terminal (macOS, Linux):
ls -al ~/.ssh
If you see id_ed25519 and id_ed25519.pub, you already have a key and can skip to Step 5.
🔑 Step 4: Generate a New SSH Key
ssh-keygen -t ed25519 -C "asha.verma@example.com"
- Press Enter to accept the default file location (
~/.ssh/id_ed25519). - Enter a passphrase (recommended) and confirm it.
This creates two files:
| File | What it is | Share it? |
|---|---|---|
~/.ssh/id_ed25519 | Private key | Never. It stays on your computer |
~/.ssh/id_ed25519.pub | Public key | Yes, you add it to GitHub |
🤖 Step 5: Add the Key to the SSH Agent
The SSH agent remembers your passphrase so you do not type it on every push.
macOS and Linux
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519
On macOS you can store the passphrase in the Keychain with ssh-add --apple-use-keychain ~/.ssh/id_ed25519.
Windows (PowerShell as Administrator)
Get-Service -Name ssh-agent | Set-Service -StartupType Manual
Start-Service ssh-agent
ssh-add $env:USERPROFILE\.ssh\id_ed25519
☁️ Step 6: Add the Public Key to GitHub
- Copy the public key:
# Windows (Git Bash)
clip < ~/.ssh/id_ed25519.pub
# macOS
pbcopy < ~/.ssh/id_ed25519.pub
# Linux: print it and copy from the terminal
cat ~/.ssh/id_ed25519.pub
- On GitHub, open Settings, SSH and GPG keys, New SSH key.
- Title: something like “Work laptop”. Key type: Authentication Key. Paste the key and click Add SSH key.
✅ Step 7: Test the Connection
ssh -T git@github.com
The first time, type yes to trust GitHub’s host fingerprint. Success looks like:
Hi asha-verma-qa! You've successfully authenticated, but GitHub does not provide shell access.
You can now clone with SSH URLs:
git clone git@github.com:your-username/your-repo.git
Switch an existing repository from HTTPS to SSH:
git remote set-url origin git@github.com:your-username/your-repo.git
Remotes are explained in Remote repositories.
🐞 Troubleshooting
| Error | Cause and fix |
|---|---|
Permission denied (publickey) | Key not added to the agent or GitHub. Run ssh-add -l to list loaded keys and check GitHub Settings, SSH keys |
Could not open a connection to your authentication agent | Start the agent: eval "$(ssh-agent -s)" (or Start-Service on Windows) |
Connection timed out on port 22 | Firewall blocks SSH. Use HTTPS, or SSH over port 443 with host ssh.github.com |
Host key verification failed | Remove the old entry with ssh-keygen -R github.com and connect again |
📝 Assignment
- Create a GitHub account with a professional username and complete your profile.
- Enable two-factor authentication and store your recovery codes safely.
- Generate an
ed25519SSH key with a passphrase and add it to the SSH agent. - Add the public key to GitHub and confirm with
ssh -T git@github.com. - Create an empty public repository called
git-practiceon GitHub; you will use it in Module 3.
❓ FAQ
🤔 How do I set up an SSH key for GitHub?
Run ssh-keygen -t ed25519 -C "your-email", add the key to the SSH agent with ssh-add, copy the .pub file into GitHub Settings, SSH and GPG keys, then test with ssh -T git@github.com.
🤔 Should I use HTTPS or SSH with GitHub?
Both are secure. HTTPS with Git Credential Manager is easiest for beginners on Windows and macOS. SSH avoids credential prompts and is common on Linux and CI servers.
🤔 Can I use my GitHub password to push code?
No. GitHub requires Git Credential Manager, an SSH key or a personal access token for Git operations.
🤔 Is it safe to share my SSH public key?
Yes. The .pub file is meant to be shared. Never share the private key file without the .pub extension.
🤔 Can I use the same SSH key on several computers?
It is better to create one key per computer. If a laptop is lost, you delete only that key from GitHub.
🎯 Next Steps
- 📁 GitHub Fundamentals: Quick Overview
- 🧱 git init, add and commit: Your First Repository
- 📘 Git and GitHub Tutorial: full course
🎬 Learn Git and GitHub step by step: watch the series on YouTube!
Subscribe to SqaToolsByDY • Practice on sqatools.in
3 thoughts on “Create a GitHub Account and Set Up SSH Keys (Windows, macOS, Linux)”