Adding SSH Keys into Github, Gitlab or Bitbucket
When working with Git repositories hosted on platforms like GitHub, Bitbucket, or GitLab, you may need to authenticate yourself to access your repositories. One way to do this is by using SSH keys, which are a secure way to connect to your repositories without having to enter your username and password each time.
Here's how to add an SSH key to your GitHub, Bitbucket, or GitLab account:
GitHub
- Open your terminal and generate a new SSH key by running the following command:
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
- Note: Replace
your_email@example.com
with the email address associated with your GitHub account. - Press
Enter
when prompted to accept the default location for your SSH key. - Enter a passphrase for your SSH key when prompted, or leave it blank if you don't want to use one.
- Open the
id_rsa.pub
file in your terminal or text editor and copy the contents of the file. - In your GitHub account, click on your profile picture in the top-right corner, and then click "Settings."
- Click "SSH and GPG keys" in the left sidebar.
- Click the "New SSH key" button.
- Give your SSH key a title and paste the contents of your
id_rsa.pub
file into the "Key" field. - Click the "Add SSH key" button.
Bitbucket
- Open your terminal and generate a new SSH key by running the following command:
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
- Note: Replace
your_email@example.com
with the email address associated with your Bitbucket account. - Press
Enter
when prompted to accept the default location for your SSH key. - Enter a passphrase for your SSH key when prompted, or leave it blank if you don't want to use one.
- Open the
id_rsa.pub
file in your terminal or text editor and copy the contents of the file. - In your Bitbucket account, click on your avatar in the bottom-left corner, and then click "Bitbucket settings."
- Click "SSH keys" in the left sidebar.
- Click the "Add key" button.
- Paste the contents of your
id_rsa.pub
file into the "Key" field. - Give your SSH key a label and click the "Add key" button.
GitLab
- Open your terminal and generate a new SSH key by running the following command:
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
- Note: Replace
your_email@example.com
with the email address associated with your GitLab account. - Press
Enter
when prompted to accept the default location for your SSH key. - Enter a passphrase for your SSH key when prompted, or leave it blank if you don't want to use one.
- Open the
id_rsa.pub
file in your terminal or text editor and copy the contents of the file. - In your GitLab account, click on your avatar in the top-right corner, and then click "Settings."
- Click "SSH keys" in the left sidebar.
- Paste the contents of your
id_rsa.pub
file into the "Key" field. - Give your SSH key a title and click the "Add key" button.
That's it! You've successfully added an SSH key to your GitHub. Please keep in mind that when using DeployBot, the SSH Key will be generated automatically, and the only thing that you might be asked would be to check if the key is added properly on the repository or not.
For more questions, you can reach us at support@deploybot.com 🙂