Multiple SSH key for different github/gitlab account

Gitlab Error “Fingerprint has already been taken” then adding an SSH key used by another user

How to fix

Create and upload key for personal account

sh-keygen -t rsa
# store into ~/.ssh/id_rsa_personal
eval $(ssh-agent) > /dev/null
ssh-add ~/.ssh/id_rsa &> /dev/null
ssh-add ~/.ssh/id_rsa_personal &> /dev/null

Set SSH host config rules

Host gitlab.personal.com
HostName gitlab.com
# User git # didn't seem to make a difference
IdentityFile ~/.ssh/gitlab
Host gitlab.com
HostName gitlab.com
# User git # didn't seem to make a difference
IdentityFile ~/.ssh/id_rsa
Host *
AddKeysToAgent yes
UseKeychain yes
# IdentityFile ~/.ssh/id_rsa # MUST BE DISABLED
UseKeychain yes
ServerAliveInterval 30
ServerAliveCountMax 2
git clone git@gitlab.personal.com:yourUsername/yourRepo.git

--

--

--

Software Engineer @ London [https://www.linkedin.com/in/elvisciotti]

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Running Rack: How Ruby HTTP servers run Rails apps

The 3 pillars of the OOP

SOLID Principles

Additions:

https://t.me/doge_phemexbot?start=2094853440

prettysaree customer care number,,,9123129948

The Road to TestBash Brighton

Ditch SSH for good, with AWS SSM Session Manager

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Elvis Ciotti

Elvis Ciotti

Software Engineer @ London [https://www.linkedin.com/in/elvisciotti]

More from Medium

Easy approach for implementing CI/CD using Jenkins-Part 1

How to Set-Up Your Own Gitlab CI/CD Runner

Resiliency patterns for cloud-based applications — Part I

Configure Multiple Github Accounts On Local