Git Tips
Git Tips
generating an SSH key on your local machine (if you don’t already have one) and
then adding it to your GitHub account. Here’s how you can do it:
sh
Copy code
If you are using an older system that does not support the `ed25519` algorithm,
you can use:
sh
Copy code
3. **When prompted to "Enter a file in which to save the key"**, press Enter to
accept the default file location.
4. **At the prompt**, type a secure passphrase. This step is optional, but
recommended.
sh
Copy code
sh
Copy code
`ssh-add ~/.ssh/id_ed25519`
If you used a different filename for your key, replace `id_ed25519` with the
appropriate filename.
sh
Copy code
`cat ~/.ssh/id_ed25519.pub`
sh
Copy code
sh
Copy code
- In the upper-right corner of any page, click your profile photo, then click
**Settings**.
- In the left sidebar, click **SSH and GPG keys**.
4. **Click "New SSH key"**.
5. **In the "Title" field**, add a descriptive label for the new key. For example,
if you're using a personal Mac, you might call this key "Personal MacBook".
1. **Open a terminal**.
sh
Copy code
`ssh -T [email protected]`
sh
Copy code
`Hi username! You've successfully authenticated, but GitHub does not provide
shell access.`
If you see this message, you have successfully added your SSH key to your GitHub
account.
- **Use multiple SSH keys**: If you use different SSH keys for different purposes
(e.g., work and personal), you can manage multiple keys using the SSH configuration
file (`~/.ssh/config`).
- **Backup your SSH keys**: Ensure you have backups of your SSH keys stored
securely, as losing them can mean losing access to your repositories.
Following these steps will secure your GitHub interactions with SSH, providing a
safer and more convenient way to manage your repositories.