SSH keys provide a secure, password-free way to interact with GitHub and other Git services (like GitLab/Bitbucket). This professional approach eliminates the need for personal access tokens or passwords in your command-line workflow. Let's set it up step by step.
Press Enter a few times to accept default locations and skip passphrase (or set a secure passphrase)
Windows users: Run this in Git Bash, not Command Prompt
🔐 Passphrase tip: A passphrase adds extra security but requires entry each time you use the key. For beginners, leave it empty. This is NOT same as the password that you use to login into GitHub.
Step 3: Add SSH Key to GitHub
Copy your public key:
Windows (Git Bash):
clip < ~/.ssh/id_rsa.pub
Mac:
pbcopy < ~/.ssh/id_rsa.pub
Linux:
xclip -sel clip < ~/.ssh/id_rsa.pub # If xclip installed# OR manually display/copy:cat ~/.ssh/id_rsa.pub
Permission denied? Ensure you copied the public key (ends with .pub)
~/.ssh missing? ssh-keygen creates it automatically
Changed GitHub email? Update email in git config and SSH key
Editor Setup: VS Code
VS Code works automatically when you have SSH keys without a passphrase. Or if your ssh-agent is enabled, and you have entered at least once your passphrase.
VSCode will use the same agent to get the passphrase when it will need it.
Troubleshooting tips:
If your VS Code does not work, try:
Windows: Launch VS Code from Git Bash:
code /path/to/your/project
Mac/Linux: Launch from terminal app
Disable Git credential helper:
git config --global credential.helper ""
Why This Matters
Security: SSH keys are more secure than passwords
Convenience: No repeated password entries
Compatibility: Works with all major Git providers
Professional: Standard practice in development teams