How to add multiple ssh keys for a single user

If you are using mul­ti­ple email addresses for dif­fer­ent ser­vices and each of them require you to enter a dif­fer­ent pub­lic key, then you need to have a pub­lic key gen­er­ated locally for each such email address.

The only catch is, the default one can live in the file called whereas the oth­ers have to live in a dif­fer­ent file and your local ssh would need to know where to find this file.

The fol­low­ing steps also help resolve the error — “Fin­ger­print has already been taken” when you are adding an exist­ing ssh key on your website

Lets say you reg­is­tered with using and with using

# First lets generate our SSH key for
ssh-keygen -t rsa -C ""
# Assume you saved the above generated key in the default file

# Now lets generate our SSH key for
# We will need to save the next key in a different file.

ssh-keygen -t rsa -C ""
# Assume you saved this one in /home/username/.ssh/id_rsa.two

The next step is to con­fig­ure SSH to look for your cus­tom file name. Here’s how thats done.
Edit your ~/.ssh/config file and add en entry for your cus­tom file name which is used by gitlab.

  User git
  IdentityFile ~/.ssh/id_rsa.two

And now you can eas­ily use each SSH key for each such website.

Ryan Sukale

Ryan is just a regular guy next door trying to manage his life and finances.

You may also like...