I have switched to SSH from HTTPS for GitHub about two years ago. And that introduced me to the term Secure Shell (SSH). Although, even now I don’t fully understand it but I’ve got a little gist of it.
SSH encrypts your data before transferring it to the server with the generated keys and when the server transfers you the data only the private key is able to decrypt the data.
Manage SSH with Bitwarden
- Generate new SSH key:
ssh-keygen -t ed25519 -C "email@example.com" -f "~/.ssh/new-ssh" - The command generates two files
~/.ssh/new-ssh: Contains the PRIVATE KEY. DO NOT SHARE THIS.~/.ssh/new-ssh.pub: Contains you public key.
- In Bitwarden desktop app, create new SSH Key > Save > Edit > Import the content of
~/.ssh/new-sshin Private Key field. The Public Key and Fingerprint field will gets update automatically. - Again in Bitwarden, go to Settings > Check “Enable SSH agent”.
- Add the Bitwarden socket file path in your config (
.bashrcor.zshrc) file. Then, restart your terminal.# For Linux/MacOS export SSH_AUTH_SOCK="$HOME/.bitwarden-ssh-agent.sock" - Now, delete the
~/.ssh/new-sshfile. After this you only have the~/.ssh/new-ssh.pubfile.rm ~/.ssh/new-ssh - Add the Public Key (content of
~/.ssh/new-ssh.pub) in your GitHub account. - Now create
~/.ssh/configfile to add the host configuration.~/.ssh/config HostName github.com User git PreferredAuthentications publickey IdentityFile ~/.ssh/new-ssh IdentitiesOnly yes - Check where your config works?
ssh -T git@github.com - Clone GitHub repo like:
git clone git@github.com:user/repo
How Does Above Config Better?
It is better because the Private Key (~/.ssh/new-ssh file) is not on your system, it is safely and securely encrypted
in Bitwarden and your tools are able to access it from Bitwarden SSH Agent. You may check it whether the Bitwarden SSH
Agent is running or not?
ssh-add -LAlso your SSH is always available in Bitwarden, you don’t need to create new you reset your system. Just copy it from Bitwarden.
Host And HostName In ~/.ssh/config
From
gemini-3-pro
Think of your ~/.ssh/config file like the Contacts app on your phone.
Host: The Nickname you give the contact (e.g., “Mom”). This is what you type.HostName: The actual Phone Number (e.g., 555-0199). This is where the call actually goes.
Modify the above ~/.ssh/config:
Host gh
HostName github.com
User git
PreferredAuthentications publickey
IdentityFile ~/.ssh/new-ssh
IdentitiesOnly yesNow you verify your SSH connection like:
ssh -T ghOr, clone GitHub repo:
git clone gh:user/repoHere the
ghworks as the alias forgit@github.com