Do you find yourself tired of entering your GitHub password every time you need to push changes to your repository? Using SSH keys for GitHub is not only more convenient but also a secure method to interact with your Git repositories. Here's a step-by-step guide on how to generate and use SSH keys for GitHub.

Before we dive into the process, ensure that you have an OpenSSH version installed on your system. This guide assumes you're using a Unix-like operating system such as Linux or MacOS. Windows users can use the OpenSSH client that comes with Windows 10 or use Git Bash.

Generating your SSH Key Pair
An SSH key pair consists of a public key and a private key. You'll share the public key with GitHub, while keeping the private key to yourself.

To generate a new SSH key pair, open your terminal and run:
``` ssh-keygen -t ed25519 -C "your_email@example.com" ```
You'll be prompted to save the key to your home directory with a filename like `~/.ssh/id_ed25519`. You can leave the filename as the default or change it. You'll also be asked to enter a passphrase for extra security. If you choose not to enter a passphrase, your key will be automatically entered when you log in.

Adding your SSH Key to the SSH Agent
To avoid entering your passphrase each time you use your keys, you can add them to the SSH agent:
``` eval "$(ssh-agent -s)" ```
Add your key to the ssh-agent:

``` ssh-add ~/.ssh/id_ed25519 ```
Displaying the Public Key
Now that your key is added to the ssh-agent, you can display the public key with:
``` cat ~/.ssh/id_ed25519.pub ```
You'll see a string that resembles:

``` ssh-ed25519 AAAAC3... your_email@example.com ```
Adding your SSH Key to GitHub
With your public key displayed, it's time to add it to your GitHub account:




















1. Click on your profile picture, then click 'Settings'.
2. In the left sidebar, click 'SSH and GPG keys'.
3. Click 'New SSH key' and provide a title for your key.
4. In the 'Key' field, paste your public key, then click 'Add key'. If prompted, you'll need to confirm your GitHub password.
Adding your SSH Key to your Git Repository
Now that your key is added to your GitHub account, you can use it for pushing changes to your repositories:
1. Open a terminal and navigate to your local repository directory.
2. To verify that the key is being used for your SSH connection, run:
``` git remote -v ```
3. If the output shows 'origin: git@github.com:username/repo.git (fetch)', 'origin: git@github.com:username/repo.git (push)', then your key is being used.
4. Finally, push your changes to GitHub using:
``` git push origin main ```
Deleting your SSH Key
If you want to remove your SSH key, you can delete it from your GitHub account:
1. Go to your GitHub settings page, and click on 'SSH and GPG keys in the side menu.
2. Find the key you want to delete, and click the 'Delete' button next to it.
That's it! Now you know how to generate, add, and use SSH keys for GitHub, making your life a bit easier while keeping your repositories secure.