β Prerequisites
-
Windows 10 or later
-
Access to Command Prompt or PowerShell
-
Git for Windows (includes
ssh
andssh-keygen
)
1. π§° Generate a New SSH Key
Open your terminal and run:
ssh-keygen -t ed25519 -C "[email protected]"
If your system doesnβt support ed25519
, use:
ssh-keygen -t rsa -b 4096 -C "[email protected]"
When prompted:
-
Save location: Press
Enter
to accept the default (C:\Users\<YourUser>\.ssh\id_ed25519
) -
Passphrase (optional but recommended): Enter a secure passphrase
2. π Add Your SSH Key to the Agent
Start the SSH agent
eval $(ssh-agent -s)
Add your private key to the agent:
ssh-add ~/.ssh/id_ed25519
π‘ Replace
id_ed25519
with your key file if you named it differently.
3. π Add Your Public Key to the Remote Server
Copy your public key to clipboard:
clip < ~/.ssh/id_ed25519.pub
Then, add it to:
-
GitHub: Settings β SSH and GPG keys
-
GitLab: Preferences β SSH Keys
-
Remote Server: Add the contents to the
~/.ssh/authorized_keys
file
4. π§ͺ Test Your Connection
Test the connection:
ssh -T [email protected]
If successful, you’ll see a welcome message:
Hi
username
! You’ve successfully authenticated.