---
title: "Git SSH Keys for GitHub, GitLab, and Bitbucket on Linux"
lang: "en"
author: "Mohammad Abu Mattar"
canonical: https://mkabumattar.com/post/git-ssh-keys-for-github-gitlab-and-bitbucket-on-linux
---

![Blog post image for Git SSH Keys for GitHub, GitLab, and Bitbucket on Linux - By default Git connects to remotes over HTTPS, so it asks for your login and password every time you run a command like git pull or git push. The SSH protocol is the alternative. It lets you connect to a server and authenticate to use its services. GitHub, GitLab, and Bitbucket all let Git connect through SSH rather than HTTPS. Public-key encryption then removes the need to type a login and password for each Git command.](/_astro/hero.ohMeiGHZ_1uWnqQ.webp)

[Home](/)›[Blog](/blog)›[All Categories](/blog/categories)›[Linux](/blog/categories/linux)

Blog

[Prev in LinuxDotfiles: A Git-Based Strategy for Configuration Management](/blog/post/dotfiles)[Next in LinuxHow To Create An AWS EC2 Instance Using AWS CLI](/blog/post/how-to-create-an-aws-ec2-instance-using-aws-cli)

[Linux](/blog/categories/linux)[Git](/blog/categories/git)[SSH](/blog/categories/ssh)[Version Control](/blog/categories/version-control)[Developer Tools](/blog/categories/developer-tools)

# Git SSH Keys for GitHub, GitLab, and Bitbucket on Linux

[Mohammad Abu Mattar](/authors/mohammad-abu-mattar)Published: 18 Dec 2021Updated: 07 Jun 202608 Mins read13 Mins listen

[Markdown for AI(opens in a new tab)](/post/git-ssh-keys-for-github-gitlab-and-bitbucket-on-linux/index.md "Open the plain-Markdown version of this page, for pasting into an AI tool")

TL;DR

By default Git connects to remotes over HTTPS, so it asks for your login and password every time you run a command like git pull or git push. The SSH protocol is the alternative. It lets you connect to a server and authenticate to use its services. GitHub, GitLab, and Bitbucket all let Git connect through SSH rather than HTTPS. Public-key encryption then removes the need to type a login and password for each Git command.

Series

[Git SSH Keys Setup](/series/git-ssh-keys-setup)1/2

[NextGit SSH Keys for GitHub, GitLab, and Bitbucket on Windows](/blog/post/git-ssh-keys-for-github-gitlab-and-bitbucket-on-windows)

All posts in this series (2)

Blog2

1.  [Git SSH Keys for GitHub, GitLab, and Bitbucket on LinuxYou are here](/blog/post/git-ssh-keys-for-github-gitlab-and-bitbucket-on-linux)
2.  [Git SSH Keys for GitHub, GitLab, and Bitbucket on Windows](/blog/post/git-ssh-keys-for-github-gitlab-and-bitbucket-on-windows)

### Git SSH Keys for GitHub, GitLab, and Bitbucket on Linux

Contents

[Introduction](#introduction)[Make sure a Git and SSH client is installed](#make-sure-a-git-and-ssh-client-is-installed)[Look for any SSH keys that have already been created](#look-for-any-ssh-keys-that-have-already-been-created)[Make a fresh set of SSH keys](#make-a-fresh-set-of-ssh-keys)[Add your private SSH key to the ssh-agent](#add-your-private-ssh-key-to-the-ssh-agent)[Add the public SSH key to your account](#add-the-public-ssh-key-to-your-account)[Test connecting via SSH](#test-connecting-via-ssh)[Frequently Asked Questions](#frequently-asked-questions)[References](#references)

## [Introduction](#introduction)

By default, Git talks to remotes over HTTPS, so it asks for your username and password on every `git pull` or `git push`. SSH fixes that. GitHub, GitLab, and Bitbucket all let Git authenticate over SSH with public-key encryption instead. Set it up once and you stop typing credentials for every Git command.

Worth knowing

An SSH key is a pair of files: a **private key** that never leaves your machine, and a **public key** you upload to each service. Authentication happens by proving you hold the private key, with no password sent over the wire.

## [Make sure a Git and SSH client is installed](#make-sure-a-git-and-ssh-client-is-installed)

A Git and SSH client must be installed on your system to connect via the SSH protocol. It should be installed by default if you use Arch Linux-based distributions like Manjaro or Garuda Linux.

Check if Git and SSH are installed

```
1git --version2ssh -V
```

That command should print the Git version and the SSH client’s version number:

Output

```
1git version 2.34.12OpenSSH_8.8p1, OpenSSL 1.1.1l  24 Aug 2021
```

If the system tells you that the `ssh` or `git` commands are missing, install them with the command set for your distribution:

-   [Arch](#tab-panel-17)
-   [Debian](#tab-panel-18)
-   [Red Hat](#tab-panel-19)
-   [SUSE](#tab-panel-20)
-   [Fedora](#tab-panel-21)

Arch-based (Manjaro, Garuda)

```
1sudo pacman -Syu2sudo pacman -Syyu3sudo pacman -S git4sudo pacman -S openssh
```

Debian-based (Ubuntu, Mint)

```
1sudo apt update2sudo apt upgrade3sudo apt install git4sudo apt install openssh
```

Red Hat-based (RHEL, CentOS)

```
1sudo yum upgrade2sudo yum install git3sudo yum install openssh
```

SUSE-based (openSUSE)

```
1sudo zypper upgrade2sudo zypper install git3sudo zypper install openssh
```

Fedora-based

```
1sudo dnf upgrade2sudo dnf install git3sudo dnf install openssh
```

After installing Git, don’t forget to set your global Git settings:

Set global Git settings

```
1git config --global user.name 'USERNAME'2git config --global user.email 'YOUR_EMAIL@EXAMPLE.COM'
```

## [Look for any SSH keys that have already been created](#look-for-any-ssh-keys-that-have-already-been-created)

Check for existing SSH keys

```
1ls -lah ~/.ssh
```

That command lists the contents of the `~/.ssh` folder, where the SSH client stores its configuration files. A typical populated directory looks like this:

-   Directory~/.ssh/
    
    -   **id\_ed25519** Ed25519 private key, never share this
    -   **id\_ed25519.pub** Ed25519 public key, safe to upload
    -   **id\_rsa** RSA private key (legacy), never share this
    -   **id\_rsa.pub** RSA public key (legacy), safe to upload
    -   known\_hosts
    -   config
    

Note

Don’t worry if you get an error saying there is no `~/.ssh` directory or no files in there. It just means you haven’t created an SSH key pair yet. Proceed to the next section if that’s the case.

Tip

It’s worth regenerating your SSH key pair about once a year. If your current pair is older than that, generate a new one below; if it’s recent and you want to keep it, skip the next section.

## [Make a fresh set of SSH keys](#make-a-fresh-set-of-ssh-keys)

Generate a new SSH key pair, replacing `YOUR_EMAIL@EXAMPLE.COM` with your email address. **Use Ed25519**: it’s what GitHub, GitLab, and Bitbucket recommend today. Reach for RSA only on an older system or server that doesn’t support Ed25519.

-   [Ed25519 (recommended)](#tab-panel-27)
-   [RSA (legacy)](#tab-panel-28)

Create a new Ed25519 SSH key pair

```
1ssh-keygen -t ed25519 -C 'YOUR_EMAIL@EXAMPLE.COM'
```

This creates `~/.ssh/id_ed25519` (private) and `~/.ssh/id_ed25519.pub` (public). Ed25519 keys are small and fast, with security on par with a 4096-bit RSA key.

Create a new RSA SSH key pair

```
1ssh-keygen -t rsa -b 4096 -C 'YOUR_EMAIL@EXAMPLE.COM'
```

This creates `~/.ssh/id_rsa` (private) and `~/.ssh/id_rsa.pub` (public). Use the older RSA type only if you need to talk to a legacy system or server that doesn’t support Ed25519.

After running the command, complete the prompts:

1.  Choose where to save the private key. Press Enter to accept the default location (`~/.ssh/id_ed25519`, or `~/.ssh/id_rsa` for an RSA key):

Output

```
1Generating public/private ed25519 key pair. Enter file in which to save the key (/home/your_user_name/.ssh/id_ed25519):
```

2.  If a private key already exists, you’ll be asked whether to overwrite it. Type `y` and press Enter:

Output

```
1/home/your_user_name/.ssh/id_ed25519 already exists.2Overwrite (y/n)?
```

3.  Enter and re-enter a passphrase (think of it as a password for the key):

Output

```
1Enter passphrase (empty for no passphrase):2Enter same passphrase again:
```

Tip

A passphrase encrypts your private key on disk, so a stolen key file is useless without it. Combined with the `ssh-agent` (next section), you only type it once per session.

The SSH key pair is created in `~/.ssh`, and the whole interaction should look like this:

-   [Ed25519 (recommended)](#tab-panel-29)
-   [RSA (legacy)](#tab-panel-30)

Output

```
1your_user_name@your_host_name:~> ssh-keygen -t ed25519 -C 'YOUR_EMAIL@EXAMPLE.COM'2Generating public/private ed25519 key pair.3Enter file in which to save the key (/home/YOUR_USER_NAME/.ssh/id_ed25519):4/home/YOUR_USER_NAME/.ssh/id_ed25519 already exists.5Overwrite (y/n)? y6Enter passphrase (empty for no passphrase):7Enter same passphrase again:8Your identification has been saved in /home/YOUR_USER_NAME/.ssh/id_ed25519.9Your public key has been saved in /home/YOUR_USER_NAME/.ssh/id_ed25519.pub.10The key fingerprint is:11SHA256:Qx3yXenY8FOQmvIsjKVp6oAlITe3k1aMKRdViOFePP6 YOUR_EMAIL@EXAMPLE.COM12The key's randomart image is:13+--[ED25519 256]--+14|        .o+.     |15|       .oo=o     |16|      . o*+.o    |17|     . ..oB.+    |18|      o.S=.* .   |19|     . +o.E o    |20|      o.o+.= .   |21|       =o.++o    |22|      ..o**+.    |23+----[SHA256]-----+24YOUR_USER_NAME@YOUR_HOST_NAME:~>
```

Output

```
1your_user_name@your_host_name:~> ssh-keygen -t rsa -b 4096 -C 'YOUR_EMAIL@EXAMPLE.COM'2Generating public/private rsa key pair.3Enter file in which to save the key (/home/YOUR_USER_NAME/.ssh/id_rsa):4/home/YOUR_USER_NAME/.ssh/id_rsa already exists.5Overwrite (y/n)? y6Enter passphrase (empty for no passphrase):7Enter same passphrase again:8Your identification has been saved in /home/YOUR_USER_NAME/.ssh/id_rsa.9Your public key has been saved in /home/YOUR_USER_NAME/.ssh/id_rsa.pub.10The key fingerprint is:11SHA256:XenY8FOQmvIsjKVp6oAlITe3k1aMKRdViOFePP6/CuK YOUR_EMAIL@EXAMPLE.COM12The key's randomart image is:13+---[RSA 4096]----+14|o.=@X++.         |15|o*@O++           |16|=Bo+=+           |17|Oo+ oo..         |18|=+ . .. S        |19|...   o          |20| .   o .         |21|    . . o        |22|   E   . o.      |23+----[SHA256]-----+24YOUR_USER_NAME@YOUR_HOST_NAME:~>
```

## [Add your private SSH key to the ssh-agent](#add-your-private-ssh-key-to-the-ssh-agent)

If you’d rather not retype your passphrase every time you use the key, add it to the `ssh-agent`, a background process that keeps your keys in memory while you’re logged in.

1.  Start the `ssh-agent` in the background:

Start the ssh-agent

```
1eval "$(ssh-agent -s)"
```

The command prints the `ssh-agent` process ID:

Output

```
1Agent pid 2887
```

2.  Add your SSH private key to the `ssh-agent`. Pick the tab for your key type:

-   [Ed25519 (recommended)](#tab-panel-13)
-   [RSA (legacy)](#tab-panel-14)

Add the Ed25519 private key to the ssh-agent

```
1ssh-add ~/.ssh/id_ed25519
```

Add the RSA private key to the ssh-agent

```
1ssh-add ~/.ssh/id_rsa
```

3.  Type your passphrase and press Enter:

Output

```
1Enter passphrase for /home/YOUR_USER_NAME/.ssh/id_ed25519:
```

The `ssh-agent` confirms the private SSH key has been added:

Output

```
1Identity added: /home/YOUR_USER_NAME/.ssh/id_ed25519 (YOUR_EMAIL@EXAMPLE.COM)
```

## [Add the public SSH key to your account](#add-the-public-ssh-key-to-your-account)

You can connect through SSH once you have an SSH key and have added it to the `ssh-agent`. The procedure is the same for all three services: copy your public key to the clipboard, then paste it into the service’s SSH-keys settings.

`xclip` is a command-line tool that gives you access to the clipboard from the terminal. If it isn’t already installed, install it for your distribution:

-   [Arch](#tab-panel-22)
-   [Debian](#tab-panel-23)
-   [Red Hat](#tab-panel-24)
-   [SUSE](#tab-panel-25)
-   [Fedora](#tab-panel-26)

Arch-based (Manjaro, Garuda)

```
1sudo pacman -Syu2sudo pacman -Syyu3sudo pacman -S xclip
```

Debian-based (Ubuntu, Mint)

```
1sudo apt update2sudo apt upgrade3sudo apt install xclip
```

Red Hat-based (RHEL, CentOS)

```
1sudo yum upgrade2sudo yum install xclip
```

SUSE-based (openSUSE)

```
1sudo zypper upgrade2sudo zypper install xclip
```

Fedora-based

```
1sudo dnf upgrade2sudo dnf install xclip
```

Using the `xclip` command, copy the contents of your public SSH key to the clipboard. Pick the tab that matches the key type you created:

-   [Ed25519 (recommended)](#tab-panel-15)
-   [RSA (legacy)](#tab-panel-16)

Copy the Ed25519 public key to the clipboard

```
1xclip -sel clip < ~/.ssh/id_ed25519.pub
```

Copy the RSA public key to the clipboard

```
1xclip -sel clip < ~/.ssh/id_rsa.pub
```

Careful here

Only ever copy and paste the **public** key (the `.pub` file). The private key (`id_ed25519` or `id_rsa`, with no extension) must never be uploaded or shared with anyone.

Now add that public key to your account. Pick your service below:

-   [GitHub](#tab-panel-10)
-   [GitLab](#tab-panel-11)
-   [Bitbucket](#tab-panel-12)

Sign in to your GitHub account by going to github.com and entering your username and password. Click your profile photo in the upper-right corner of the page, then **Settings**:

![GitHub Settings](/assets/blog/0001-git-ssh-keys-for-github-gitlab-and-bitbucket-on-linux/github1.png)

Select **SSH and GPG keys** from the user settings sidebar, then select **New SSH key**. Put a descriptive label for the new key in the Title area (for example, your computer’s name) and paste your public key into the Key field. Finally, click **Add SSH key**:

![GitHub Settings](/assets/blog/0001-git-ssh-keys-for-github-gitlab-and-bitbucket-on-linux/github2.png)

The key is now visible in the list of SSH keys linked to your account:

![GitHub Settings](/assets/blog/0001-git-ssh-keys-for-github-gitlab-and-bitbucket-on-linux/github3.png)

Sign in to your GitLab account by going to gitlab.com and entering your username and password. Click your profile photo in the upper-right corner of the page, then **Settings**:

![GitLab Settings](/assets/blog/0001-git-ssh-keys-for-github-gitlab-and-bitbucket-on-linux/gitlab1.png)

Click **SSH Keys** in the User Settings sidebar. In the Key area, paste your public key. Fill in the Title field with a descriptive term (for example, the name of your computer). Finally, click **Add key**:

![GitLab Settings](/assets/blog/0001-git-ssh-keys-for-github-gitlab-and-bitbucket-on-linux/gitlab2.png)

The key is now visible in the list of SSH keys linked to your account:

![GitLab Settings](/assets/blog/0001-git-ssh-keys-for-github-gitlab-and-bitbucket-on-linux/gitlab3.png)

Log in to your Bitbucket account by going to bitbucket.org and entering your username and password. Click your profile photo in the lower-left corner of the website, then **Bitbucket settings**:

![Bitbucket Settings](/assets/blog/0001-git-ssh-keys-for-github-gitlab-and-bitbucket-on-linux/bitbucket1.png)

You’ll find SSH keys in the Settings sidebar’s **Security** section. From there, select **Add key**. Fill in the Description box with a descriptive label for the new key (such as your computer’s name), then paste your public key into the Key field. Finally, choose **Add key**:

![Bitbucket Settings](/assets/blog/0001-git-ssh-keys-for-github-gitlab-and-bitbucket-on-linux/bitbucket2.png)

The key now appears in your account’s list of SSH keys:

![Bitbucket Settings](/assets/blog/0001-git-ssh-keys-for-github-gitlab-and-bitbucket-on-linux/bitbucket3.png)

## [Test connecting via SSH](#test-connecting-via-ssh)

Before you start using SSH with Git, all three services let you check that the connection works.

-   [GitHub](#tab-panel-31)
-   [GitLab](#tab-panel-32)
-   [Bitbucket](#tab-panel-33)

Once you’ve added your SSH key to your GitHub account, open the terminal and type:

Test connecting via SSH

```
1ssh -T git@github.com
```

If you’re connecting to GitHub over SSH for the first time, the SSH client will ask if you trust the GitHub server’s public key:

Output

```
1The authenticity of host 'github.com (140.82.113.4)' can't be established.2RSA key fingerprint is SHA256:a5d6c20b1790b4c144b9d26c9b201bbee3797aa010f2701c09c1b3a6262d2c02.3Are you sure you want to continue connecting (yes/no)?
```

Type `yes` and press Enter. GitHub is added to the list of trustworthy hosts in the SSH client, and you won’t be asked about its public key again:

Output

```
1Warning: Permanently added 'github.com,140.82.113.4' (RSA) to the list of known hosts.
```

GitHub only allows this SSH connection for testing, not shell access, so it confirms you’re authenticated and then closes the connection:

Output

```
1Hi YOUR_USER_NAME! You've successfully authenticated, but GitHub does not provide shell access.
```

The entire interaction should look something like this:

Output

```
1ssh -T git@github.com2
3The authenticity of host 'github.com (140.82.113.4)' can't be established.4RSA key fingerprint is SHA256:a5d6c20b1790b4c144b9d26c9b201bbee3797aa010f2701c09c1b3a6262d2c02.5Are you sure you want to continue connecting (yes/no)? yes6Warning: Permanently added 'github.com,140.82.113.4' (RSA) to the list of known hosts.7Hi your_user_name! You've successfully authenticated, but GitHub does not provide shell access.8YOUR_USER_NAME@YOUR_HOST_NAME:~>
```

Test passed: you’re ready to use SSH with GitHub.

Once you’ve added your SSH key to your GitLab account, the test is pretty similar:

Test connecting via SSH

```
1ssh -T git@gitlab.com2
3The authenticity of host 'gitlab.com (35.231.145.151)' can't be established.4ECDSA key fingerprint is SHA256:4ac7a7fd4296d5e6267c9188346375ff78f6097a802e83c0feaf25277c9e70cc.5Are you sure you want to continue connecting (yes/no)? yes6Warning: Permanently added 'gitlab.com,35.231.145.151' (ECDSA) to the list of known hosts.7Welcome to GitLab, @YOUR_USER_NAME!
```

Test passed: you’re ready to use SSH with GitLab.

Once you’ve added your SSH key to your Bitbucket account, the test is pretty similar:

Test connecting via SSH

```
1ssh -T git@bitbucket.org2
3The authenticity of host 'bitbucket.org (104.192.143.1)' can't be established.4RSA key fingerprint is SHA256:fb7d37d5497c43f73325e0a98638cac8dda3b01a8c31f4ee11e2e953c19e0252.5Are you sure you want to continue connecting (yes/no)? yes6Warning: Permanently added 'bitbucket.org,104.192.143.1' (RSA) to the list of known hosts.7logged in as YOUR_USER_NAME.8
9You can use git or hg to connect to Bitbucket. Shell access is disabled.
```

Test passed: you’re ready to use SSH with Bitbucket.

## [Frequently Asked Questions](#frequently-asked-questions)

Yes. A passphrase encrypts the private key on disk, so if the file is ever stolen it’s useless without the passphrase. Pair it with the `ssh-agent` so you only type it once per login session rather than on every Git command.

Use `ed25519`. The keys are smaller and faster than RSA with comparable security, and it’s what GitHub, GitLab, and Bitbucket recommend. Generate one with `ssh-keygen -t ed25519 -C 'YOUR_EMAIL@EXAMPLE.COM'`. Reach for `rsa -b 4096` only when you need to connect to an older server that doesn’t speak Ed25519.

Yes. The same **public** key can be added to as many accounts and services as you like. There’s no need for a separate key per provider. Just paste `~/.ssh/id_ed25519.pub` (or `id_rsa.pub`) into each service’s SSH-keys settings.

Usually one of: the key wasn’t added to the `ssh-agent` (`ssh-add ~/.ssh/id_ed25519`), the public key wasn’t added to the service, or the wrong key path is being used. Run `ssh -vT git@github.com` to see which key the client offers, and confirm `~/.ssh` permissions are `700` and the private key is `600`.

The `ssh-agent` isn’t running or isn’t persisting between sessions. Start it with `eval "$(ssh-agent -s)"` and add the key with `ssh-add`. To make it stick automatically, add `AddKeysToAgent yes` (and optionally `UseKeychain yes` on macOS) under your host in `~/.ssh/config`.

* * *

## [References](#references)

-   [GitHub Docs: Generating a new SSH key and adding it to the ssh-agent](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent)
-   [GitHub Docs: Adding a new SSH key to your GitHub account](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account)
-   [GitHub Docs: Working with SSH key passphrases](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/working-with-ssh-key-passphrases)
-   [GitLab Docs: Use SSH keys to communicate with GitLab](https://docs.gitlab.com/ee/user/ssh.html)
-   [Bitbucket Docs: Set up an SSH key](https://support.atlassian.com/bitbucket-cloud/docs/set-up-an-ssh-key/)
-   [OpenSSH Official Website](https://www.openssh.com/)
-   [`ssh-keygen` man page](https://man.openbsd.org/ssh-keygen.1)
-   [`ssh-agent` man page](https://man.openbsd.org/ssh-agent.1)
-   [`ssh-add` man page](https://man.openbsd.org/ssh-add.1)
-   [ArchWiki: SSH keys](https://wiki.archlinux.org/title/SSH_keys)
-   [DigitalOcean: How To Set Up SSH Keys](https://www.digitalocean.com/community/tutorials/how-to-set-up-ssh-keys-2)
-   [Git SCM Book: Git on the Server - Generating Your SSH Public Key](https://git-scm.com/book/en/v2/Git-on-the-Server-Generating-Your-SSH-Public-Key)
-   [xclip man page (or alternative like xsel)](https://linux.die.net/man/1/xclip)
-   [SSH (Secure Shell) Protocol Overview](https://www.ssh.com/academy/ssh)

Was this useful?

## Tags

[#SSH Keys](/blog/tags/ssh-keys)[#Ed25519](/blog/tags/ed25519)[#GitHub SSH](/blog/tags/github-ssh)[#GitLab SSH](/blog/tags/gitlab-ssh)[#Bitbucket SSH](/blog/tags/bitbucket-ssh)[#Git Authentication](/blog/tags/git-authentication)[#Linux SSH](/blog/tags/linux-ssh)[#OpenSSH](/blog/tags/openssh)[#Ssh keygen](/blog/tags/ssh-keygen)[#Ssh agent](/blog/tags/ssh-agent)[#Git Setup](/blog/tags/git-setup)

## Share

[Facebook](https://facebook.com/sharer/sharer.php?u=https%3A%2F%2Fmkabumattar.com%2Fblog%2Fpost%2Fgit-ssh-keys-for-github-gitlab-and-bitbucket-on-linux "Share on Facebook")[Twitter](https://twitter.com/intent/tweet/?text=Git%20SSH%20Keys%20for%20GitHub%2C%20GitLab%2C%20and%20Bitbucket%20on%20Linux&url=https%3A%2F%2Fmkabumattar.com%2Fblog%2Fpost%2Fgit-ssh-keys-for-github-gitlab-and-bitbucket-on-linux "Share on Twitter")[LinkedIn](https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fmkabumattar.com%2Fblog%2Fpost%2Fgit-ssh-keys-for-github-gitlab-and-bitbucket-on-linux&title=Git%20SSH%20Keys%20for%20GitHub%2C%20GitLab%2C%20and%20Bitbucket%20on%20Linux&summary=By%20default%20Git%20connects%20to%20remotes%20over%20HTTPS%2C%20so%20it%20asks%20for%20your%20login%20and%20password%20every%20time%20you%20run%20a%20command%20like%20git%20pull%20or%20git%20push.%20The%20SSH%20protocol%20is%20the%20alternative.%20It%20lets%20you%20connect%20to%20a%20server%20and%20authenticate%20to%20use%20its%20services.%20GitHub%2C%20GitLab%2C%20and%20Bitbucket%20all%20let%20Git%20connect%20through%20SSH%20rather%20than%20HTTPS.%20Public-key%20encryption%20then%20removes%20the%20need%20to%20type%20a%20login%20and%20password%20for%20each%20Git%20command.&source=https://mkabumattar.com "Share on LinkedIn")[WhatsApp](https://wa.me/?text=Git%20SSH%20Keys%20for%20GitHub%2C%20GitLab%2C%20and%20Bitbucket%20on%20Linux%20https%3A%2F%2Fmkabumattar.com%2Fblog%2Fpost%2Fgit-ssh-keys-for-github-gitlab-and-bitbucket-on-linux "Share on WhatsApp")[Telegram](https://t.me/share/url?url=https%3A%2F%2Fmkabumattar.com%2Fblog%2Fpost%2Fgit-ssh-keys-for-github-gitlab-and-bitbucket-on-linux&text=Git%20SSH%20Keys%20for%20GitHub%2C%20GitLab%2C%20and%20Bitbucket%20on%20Linux "Share on Telegram")[Reddit](https://www.reddit.com/submit?url=https%3A%2F%2Fmkabumattar.com%2Fblog%2Fpost%2Fgit-ssh-keys-for-github-gitlab-and-bitbucket-on-linux&title=Git%20SSH%20Keys%20for%20GitHub%2C%20GitLab%2C%20and%20Bitbucket%20on%20Linux "Share on Reddit")[Hacker News](http://news.ycombinator.com/submitlink?u=https%3A%2F%2Fmkabumattar.com%2Fblog%2Fpost%2Fgit-ssh-keys-for-github-gitlab-and-bitbucket-on-linux&t=Git%20SSH%20Keys%20for%20GitHub%2C%20GitLab%2C%20and%20Bitbucket%20on%20Linux "Share on Hacker News")[Pinterest](https://pinterest.com/pin/create/button/?url=https%3A%2F%2Fmkabumattar.com%2Fblog%2Fpost%2Fgit-ssh-keys-for-github-gitlab-and-bitbucket-on-linux&media=&description=By%20default%20Git%20connects%20to%20remotes%20over%20HTTPS%2C%20so%20it%20asks%20for%20your%20login%20and%20password%20every%20time%20you%20run%20a%20command%20like%20git%20pull%20or%20git%20push.%20The%20SSH%20protocol%20is%20the%20alternative.%20It%20lets%20you%20connect%20to%20a%20server%20and%20authenticate%20to%20use%20its%20services.%20GitHub%2C%20GitLab%2C%20and%20Bitbucket%20all%20let%20Git%20connect%20through%20SSH%20rather%20than%20HTTPS.%20Public-key%20encryption%20then%20removes%20the%20need%20to%20type%20a%20login%20and%20password%20for%20each%20Git%20command. "Share on Pinterest")[Email](<mailto:?subject=Git%20SSH%20Keys%20for%20GitHub%2C%20GitLab%2C%20and%20Bitbucket%20on%20Linux&body=Check out this article: https%3A%2F%2Fmkabumattar.com%2Fblog%2Fpost%2Fgit-ssh-keys-for-github-gitlab-and-bitbucket-on-linux>)

## Comments

## You might also enjoy

More posts on similar topics

[![Git SSH Keys for GitHub, GitLab, and Bitbucket on Windows](/_astro/hero.CT0gfesP_1kDHLR.webp)](/blog/post/git-ssh-keys-for-github-gitlab-and-bitbucket-on-windows)

## [Git SSH Keys for GitHub, GitLab, and Bitbucket on Windows](/blog/post/git-ssh-keys-for-github-gitlab-and-bitbucket-on-windows)

-   [Mohammad Abu Mattar](/authors/mohammad-abu-mattar)
-   [Git](/blog/categories/git)
-   [SSH](/blog/categories/ssh)
-   [Windows](/blog/categories/windows)
-   [Version Control](/blog/categories/version-control)
-   [Security](/blog/categories/security)
-   [Developer Tools](/blog/categories/developer-tools)

Introduction By default, Git talks to remotes over HTTPS, so it asks for your username and password on every git pull or git push. SSH fixes that. GitHub, GitLab, and Bitbucket all let Git aut

[#SSH Key Generation](/blog/tags/ssh-key-generation)[#Ed25519](/blog/tags/ed25519)[#Git Configuration](/blog/tags/git-configuration)+8 tags

[read more](/blog/post/git-ssh-keys-for-github-gitlab-and-bitbucket-on-windows)

[![Dotfiles: A Git-Based Strategy for Configuration Management](/_astro/hero.wfzXy7kc_dMWKx.webp)](/blog/post/dotfiles)

## [Dotfiles: A Git-Based Strategy for Configuration Management](/blog/post/dotfiles)

-   [Mohammad Abu Mattar](/authors/mohammad-abu-mattar)
-   [Linux](/blog/categories/linux)
-   [Git](/blog/categories/git)
-   [Configuration Management](/blog/categories/configuration-management)
-   [Developer Tools](/blog/categories/developer-tools)
-   [Productivity](/blog/categories/productivity)

Introduction Your dotfiles, those hidden .-prefixed configuration files scattered across your home directory, are the muscle memory of your environment. They hold your shell aliases, your editor

[#Dotfiles Management](/blog/tags/dotfiles-management)[#Git Bare Repository](/blog/tags/git-bare-repository)[#Shell Configuration](/blog/tags/shell-configuration)+7 tags

[read more](/blog/post/dotfiles)

[![10+ Secret Git Commands That Will Save Hours Every Week](/_astro/hero.BrIIpyXb_8Js6X.webp)](/blog/post/10-secret-git-commands-to-save-time)

## [10+ Secret Git Commands That Will Save Hours Every Week](/blog/post/10-secret-git-commands-to-save-time)

-   [Mohammad Abu Mattar](/authors/mohammad-abu-mattar)
-   [Git](/blog/categories/git)
-   [Version Control](/blog/categories/version-control)
-   [DevOps](/blog/categories/devops)
-   [Software Development](/blog/categories/software-development)
-   [Productivity](/blog/categories/productivity)

Introduction As a software engineer, DevOps engineer, or GitHub user, you probably use Git daily. But are you making the most of it? Git is packed with commands that can save you hours of manual w

[#Git Commands](/blog/tags/git-commands)[#Git Tips](/blog/tags/git-tips)[#Version Control](/blog/tags/version-control)+7 tags

[read more](/blog/post/10-secret-git-commands-to-save-time)

[![VIM Cheat Sheet](/_astro/hero.Buk-UDGW_2r0YqI.webp)](/blog/post/vim-cheat-sheet)

## [VIM Cheat Sheet](/blog/post/vim-cheat-sheet)

-   [Mohammad Abu Mattar](/authors/mohammad-abu-mattar)
-   [Linux](/blog/categories/linux)
-   [VIM](/blog/categories/vim)
-   [Text Editors](/blog/categories/text-editors)
-   [Developer Tools](/blog/categories/developer-tools)
-   [Command Line](/blog/categories/command-line)

What is VIM? VIM (Vi Improved) is a versatile text editor pre-installed on most Linux systems, known for its efficiency in command-line file editing. Its modal nature, switching between modes like

[#VIM Commands](/blog/tags/vim-commands)[#VIM Cheat Sheet](/blog/tags/vim-cheat-sheet)[#Text Editing](/blog/tags/text-editing)+5 tags

[read more](/blog/post/vim-cheat-sheet)

[![How to Install and Configure Node.js on EC2 Instance Amazon Linux 2](/_astro/hero.CIYv_zEL_2aFueX.webp)](/blog/post/how-to-install-and-configure-nodejs-on-ec2-instance-amazon-linux-2)

## [How to Install and Configure Node.js on EC2 Instance Amazon Linux 2](/blog/post/how-to-install-and-configure-nodejs-on-ec2-instance-amazon-linux-2)

-   [Mohammad Abu Mattar](/authors/mohammad-abu-mattar)
-   [AWS](/blog/categories/aws)
-   [EC2](/blog/categories/ec2)
-   [Node.js](/blog/categories/nodejs)
-   [Linux](/blog/categories/linux)

Introduction Node.js does not exist in the default Amazon Linux 2 repository. So, we need to add the Node.js repository to the system. In this post, we will learn how to install and configure Node

[#Node.js Installation](/blog/tags/nodejs-installation)[#Amazon Linux 2](/blog/tags/amazon-linux-2)[#AWS EC2 Setup](/blog/tags/aws-ec2-setup)+3 tags

[read more](/blog/post/how-to-install-and-configure-nodejs-on-ec2-instance-amazon-linux-2)

[![How to Install and Setup FireWall on Amazon Linux 2](/_astro/hero.b8oDtFR4_ZdWcUP.webp)](/blog/post/how-to-install-and-setup-firewall-on-amazon-linux-2)

## [How to Install and Setup FireWall on Amazon Linux 2](/blog/post/how-to-install-and-setup-firewall-on-amazon-linux-2)

-   [Mohammad Abu Mattar](/authors/mohammad-abu-mattar)
-   [AWS](/blog/categories/aws)
-   [EC2](/blog/categories/ec2)
-   [Linux](/blog/categories/linux)
-   [Firewall](/blog/categories/firewall)
-   [Security](/blog/categories/security)

Introduction This tutorial covers installing and configuring firewalld on Amazon Linux 2, including setting the default zone and managing services and ports. Prerequisites To follow along wit

[#Firewalld](/blog/tags/firewalld)[#Amazon Linux 2](/blog/tags/amazon-linux-2)[#EC2 Security](/blog/tags/ec2-security)+5 tags

[read more](/blog/post/how-to-install-and-setup-firewall-on-amazon-linux-2)

6 related posts
