Friday, October 18, 2024

SSH Setup for GitHub in Windows

Follow the below listed steps to set up SSH for GitHub in Windows -

  • Launch Windows Powershell

  • Run the following command to generate private/public key pair
    ssh-keygen -t ed25519 -C "<your GitHub email address">

  • Once the key pair has been generated, we need to ensure the SSH agent is running. This command has to be run in a Windows Powershell with elevated privileges
    Get-Service -Name ssh-agent | Set-Service -StartupType Manual
    Start-Service ssh-agent

  • We need to add the SSH key to the SSH agent
    ssh-add "<Location of public key generated in earlier step>"

  • Configure Git to use the Windows Open SSH agent
    git config --global core.sshCommand "C:\Windows\System32\OpenSSH\ssh.exe"

  • Add the public key to your GitHub account

  • Test your SSH connection
    ssh -T git@github.com

No comments:

Post a Comment