To generate a new SSH key on GitHub, follow these steps:
- Open the terminal or command prompt.
- Enter the following command, replacing "[email protected]" with your registered email address on GitHub.
ssh-keygen -t rsa -b 4096 -C "[email protected]"
- Later, you will be prompted to enter the file save location and passphrase. You can keep all the default settings and simply press Enter.
- Then enter the following command: eval "$(ssh-agent -s)"
- Next, enter the following command to add the new key to the ssh-agent: ssh-add ~/.ssh/id_rsa
- Finally, add your public key to GitHub. Go to GitHub settings and click on "SSH and GPG keys".
- Click on the "New key" button.
- Enter a descriptive title in the "Title" field so that you can identify this key.
- In the "Key" field, copy and paste the contents of the "~/.ssh/id_rsa.pub" file.
- Click the "Add SSH key" button to save your new key.
Now, you have successfully generated a new SSH key for GitHub!
Tutorial from chatGPT, just documenting it.