If you’re not already familiar, SSH, or secure shell, is a network protocol that allows you to safely encrypt any data you’re pushing from a local computer to a server over the Internet.
GitKraken makes the process of generating new SSH keys and adding them to GitHub easy, safe, and intuitive.
GitHub How to Add SSH Key
Why would you want to add an SSH key to GitHub? Instead of using usernames and passwords every time you push and pull changes from your GitHub repository, you can use an SSH key instead.
Using SSH keys with Git is convenient because they prevent the need to remember a complex password, yet you can use a very long and secure password to secure your account. An SSH key works just like an actual physical key that only you possess.
GitHub Add SSH Key in GitKraken
If you’re using GitKraken’s robust GitHub integration, you will be able to provide the path to your existing SSH key pair from GitHub, or ask GitKraken to generate a new SSH key pair for you.
To start the process of adding an SSH key to GitHub, you will need to first connect GitKraken’s GitHub integration. You can do this by clicking the gear ⚙️ icon to access your Preferences → Integrations → GitHub. Next, click Connect to GitHub.
This will open your default browser to GitHub.com where you will complete the GitHub integration process.
Once you have successfully connected the GitHub integration in GitKraken, you will be able to click Generate SSH key and add to GitHub in GitKraken. After a few seconds, GitKraken will automatically generate a new SSH key and add it to your GitHub.com account!
What if you aren’t using the GitHub integration in GitKraken? Never fear; you can still connect to GitHub using SSH from within GitKraken. To do this, you will again click the gear ⚙️ icon to access your Preferences → SSH. From here, you can browse to an existing GitHub SSH key you already have, or you can ask GitKraken to add an SSH key to GitHub by clicking Generate.
After you have created the SSH key for GitHub, you will need to manually add it to your GitHub.com account. To add the SSH key, you will navigate to GitHub.com on your browser and login. Next, click your avatar in the upper right and go to Settings → SSH and GPG keys → New SSH key.
Next, you will copy your public SSH key from GitKraken and paste into the Key field shown above in your GitHub account, along with whatever title makes the most sense in the Title.
ProTip: you can click the Copy file contents to clipboard button in GitKraken to quickly and conveniently copy the entire SSH key to GitHub.
After you have added information into the Title and Key fields, click Add SSH Key in GitHub to complete the process of adding your SSH key to GitHub. Easy as that!
GitKraken’s secure GitHub integration makes it clear and convenient to quickly add SSH keys to GitHub for safe encryption of your data.
GitHub Add SSH Key in the CLI
To begin the process of adding an SSH key to GitHub using the CLI, you will open your terminal of choice, like the GitKraken CLI.
Next, you will use the following command, using the email associated with your GitHub account.
ssh-keygen -t rsa -b 4096 -C “you [email protected]”
However, if you prefer the use the newer Ed25519
algorithm to add a GitHub SSH key, you can use:
ssh-keygen -t ed25519 -C “[email protected]”
Git will then throw you several prompts. This first will be to choose the file location. It should look something like this:
Enter file in which to save the key (/c/Users/alexl/.ssh/id_rsa):
From here, you can hit Enter to accept the default location. Alternatively, if you already have a SSH key in the default location, you will be asked whether you want to override the existing SSH key you’re using in GitHub.
The next prompt you will see is to enter a passphrase for the SSH key associated with GitHub. It should look something like this:
Enter passphrase (empty for no passphrase)
You can click Enter here to skip adding a passphrase.
After a few seconds, you will see that your new SSH key has been generated! The below example is adding an SSH key to GitHub on Windows 10 with the user alexl
.
Now, you can browse to the file location you specified earlier to find your public and private SSH keys. Here’s an example of a default location on a Windows machine:
Once your SSH key has been generated, you will need to manually add the SSH key to your GitHub.com account. You can do this by going to GitHub.com, logging in, and then clicking your account avatar in the upper right. This will take you to Settings where you can then navigate to SSH and GPG keys → New SSH key.
Next, you will open your public SSH key file (the .pub
file in this example), highlight all of the text, and copy/paste the text into the Key field shown above in GitHub.
Finally, you will hit Add SSH Key to complete the process of adding an SSH key to GitHub.
GitKraken’s powerful GitHub integration doesn’t stop with SSH keys; GitHub users can enjoy interactive pull request management, integration with GitHub Issues, and more.