Create a GitHub Account and Set Up SSH Keys (Windows, macOS, Linux)

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.

Advertisement

📖 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

  1. Go to github.com and click Sign up.
  2. Enter your email, a strong password and a username.
  3. Verify your email address with the code GitHub sends you.
  4. 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:

  1. Open Settings, Password and authentication.
  2. Enable 2FA with an authenticator app (Google Authenticator, Microsoft Authenticator, Authy) or a passkey.
  3. 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:

HTTPSSSH
Remote URLhttps://github.com/user/repo.gitgit@github.com:user/repo.git
AuthenticationGit Credential Manager (browser sign-in) or a personal access tokenAn SSH key pair on your computer
Setup effortVery low on Windows and macOSOne-time key setup
Works through strict firewallsUsuallySometimes blocked (port 22)
Popular withBeginners, Windows usersDevelopers, 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:

FileWhat it isShare it?
~/.ssh/id_ed25519Private keyNever. It stays on your computer
~/.ssh/id_ed25519.pubPublic keyYes, 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

  1. 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
  1. On GitHub, open Settings, SSH and GPG keys, New SSH key.
  2. 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

ErrorCause 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 agentStart the agent: eval "$(ssh-agent -s)" (or Start-Service on Windows)
Connection timed out on port 22Firewall blocks SSH. Use HTTPS, or SSH over port 443 with host ssh.github.com
Host key verification failedRemove the old entry with ssh-keygen -R github.com and connect again

📝 Assignment

  1. Create a GitHub account with a professional username and complete your profile.
  2. Enable two-factor authentication and store your recovery codes safely.
  3. Generate an ed25519 SSH key with a passphrase and add it to the SSH agent.
  4. Add the public key to GitHub and confirm with ssh -T git@github.com.
  5. Create an empty public repository called git-practice on 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

🎬 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)”

Leave a Comment