如何在 Windows 和 macOS 上建立 SSH 金鑰並新增至 GitHub | How to Create SSH Key and Add to GitHub on Windows and macOS

LH
Eic’s notes
Published in
3 min readJul 27, 2024

--

Here are steps for creating an SSH key and adding it to GitHub, tailored for both Windows and macOS:

On Windows

  1. Open Git Bash:
  • Open the Git Bash application.

2. Generate a new SSH key:

  • Run the following command, replacing your_email@example.com with your GitHub email address:
ssh-keygen -t ed25519 -C "your_email@example.com"
  • If your system does not support Ed25519, use:
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

3. Follow the prompts:

  • Accept the default file location by pressing Enter.
  • Optionally, enter a passphrase for additional security.

4. Start the SSH agent:

  • Run the following command:
eval "$(ssh-agent -s)"

5. Add your SSH key to the ssh-agent:

  • Run the following command, adjusting the path if you used a different file name:
ssh-add ~/.ssh/id_ed25519

--

--

LH
Eic’s notes

初級軟件工程師 | 技術貼文, 不定期更新