Tuesday, November 10, 2026
Translate
PrivacySubmit newsShare your story Newsletter Advertise
Breaking
How-to guides news

How to Generate and Add a New SSH Key to GitHub

Learn how to generate an SSH key and add it to the ssh-agent for secure GitHub authentication.

How to Generate and Add a New SSH Key to GitHub. Source: GitHub

Using these official steps from GitHub, you will be able to generate a new SSH key, add it to the ssh-agent, and authenticate your Git operations securely.

What it does

You can access and write data in repositories on GitHub using the Secure Shell Protocol (SSH). When you connect via SSH, you authenticate using a private key file on your local machine.

Before you start

You should check for existing SSH keys before generating a new one. You will also need access to Terminal, Git Bash, or PowerShell, along with your GitHub email address.

The TechUpscale Brief. The day's cyber, AI and tech news in one short email, every weekday morning. Free. Unsubscribe anytime.

Steps

Step 1: Open Terminal or Git Bash and paste the command ssh-keygen -t ed25519 -C "your_email@example.com" replacing the email address with your GitHub email.

Step 2: Press Enter to accept the default file location when prompted, or type a custom path if you have created keys previously.

Step 3: Type a secure passphrase when prompted, or press Enter for no passphrase.

Step 4: Start the ssh-agent in the background by running the command eval "$(ssh-agent -s)" or your environment's specific agent startup command.

Step 5: Add your SSH private key to the ssh-agent using the command ssh-add ~/.ssh/id_ed25519 or the platform-specific equivalent.

What the company says

GitHub states that you can access and write data in repositories on GitHub using SSH. GitHub also notes that it improved security by dropping older, insecure key types on March 15, 2022.

What to do

  • Generate a new SSH key using ssh-keygen with your email address.
  • Start the ssh-agent in the background.
  • Add your SSH private key to the ssh-agent.
Key facts and where they come from
  • GitHub allows users to access and write data in repositories using SSH.
    You can access and write data in repositories on GitHub using SSH (Secure Shell Protocol).
  • GitHub dropped older, insecure key types on March 15, 2022.
    GitHub improved security by dropping older, insecure key types on March 15, 2022.

What can websites see about you? Run our free privacy check →

Add TechUpscale as a preferred source on Google

The TechUpscale Brief

The day's cyber, AI and tech news in one short email, every weekday morning. Free. Unsubscribe anytime.

I'm most interested in

Join the conversation

Comments are moderated. Be civil and stay on the story: no personal attacks, hate, spam or ads, and no one else's private details. Your email is never shown. Privacy policy.

More How-to guides