Using an SSH key with GitHub provides a secure and convenient way to connect to your repositories from the command line. Instead of entering your GitHub username and password every time you push or pull code, you can authenticate using your SSH key acting as a secure digital key unique to your machine.
This guide explains how to create an SSH key on your local device and how to upload the public portion of that key to your GitHub account. If you’ve already generated an SSH key, feel free to skip to the second section.
First, check whether you already have an SSH key:
ssh-add -l
If this command lists an existing key, you may not need to create a new one. Otherwise, follow the steps below:
Next, retrieve your new public key:
cat ~/.ssh/id_rsa.pub
Note: Your private key is exactly that private do not share this with anyone or… push it to your repository.
Once your key is created, adding it to GitHub is straightforward:
Your machine is now linked to GitHub using SSH, allowing seamless and secure access when working with your repositories. Learn how to set up git version control on cPanel.
SSH keys work for more than just GitHub. You can use them to mount remote file systems via SSH or disable strict host key checking when connecting to trusted servers.
Setting up proper development workflows matters whether you’re managing your own projects or working with clients. If you’re running a reseller business, check out how to get started with reseller hosting for tips on supporting developer clients.
Create isolated individual accounts for your clients and manage them all from one dashboard.
Get Reseller HostingUpgrade to VPS hosting for scalable resources and root access to your server.
Get VPS Hosting