Fingerprint has already been taken gitlab

GitlabSsh Keys

Gitlab Problem Overview


I formatted my Windows 7 laptop and in an attempt to have git setup working again, I installed git and source tree application.

I deleted the SSH Key from gitlab and regenerated the key using ssh-keygen. But when I try to add the SSH Key at gitlab, it throws the following exception :

Key is invalid
Fingerprint has already been taken
Fingerprint cannot be generated

Because of this I am unable to clone the git repository from the source tree application since gitlab is unable to authenticate the SSH key.I followed queries at google groups of gitlab but none of them seem to resolve my issue. Is there any workaround or steps to get the SSH key accepted by gitlab?

Gitlab Solutions


Solution 1 - Gitlab

In my case; the public key i was trying to add was already used with 'work' Gitlab account and i received the said error upon trying to use the same key with 'personal' Gitlab account.

Solution - Add another public key on the same machine and use that with 'personal' gitlab account (both on same machine).

navigate to .ssh folder in your profile (even works on windows) and run command

ssh-keygen -t rsa

when asked for file name give another filename id_rsa_2 (or any other). enter for no passphrase (or otherwise). You will end up making id_rsa_2 and id_rsa_2.pub

use the command

cat id_rsa_2.pub

copy and save key in 'personal' Gitlab account.

create a file with no extension in .ssh folder named 'config'

put this block of configuration in your config file

Host           gitlab.com
HostName       gitlab.com
IdentityFile   C:\Users\<user name>\.ssh\id_rsa
User           <user name>


Host           gitlab_2
HostName       gitlab.com
IdentityFile   C:\Users\<user name>\.ssh\id_rsa_2
User           <user name>

now whenever you want to use 'personal' gitlab account simply change alias in git URLs for action to remote servers.

for example instead of using

git clone git@gitlab.com:..............

simply use

git clone git@gitlab_2:...............

doing that would use the second configuration with gitlab.com (from 'config' file) and will use the new id_rsa_2 key pair for authentication.

Find more about above commands on this link
https://clubmate.fi/how-to-setup-and-manage-multiple-ssh-keys/

Solution 2 - Gitlab

Gitlab can use your ssh-key in another account of your past projects for somehow - so, easiest way to solve this problem is to create new ssh-pair, add it to ssh-agent and add id_rsa2.pub to your gitlab account.

$ ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

When it ask:

Generating public/private rsa key pair. 
Enter file in which to save the key (/home/<NAME>/.ssh/id_rsa):  

Please enter /home/<NAME>/.ssh/id_rsa2

$ ssh-add ~/.ssh/id_rsa2

Solution 3 - Gitlab

Make sure to cut away everything at the end of the base64 encoded string. Also remove all newlines so the string contains no newlines.

This did the trick for me.

Solution 4 - Gitlab

I got the same error because I already added this key to another account in gitlab.

Solution 5 - Gitlab

I tried everything already suggested and nothing worked. What ended up working for me was to copy the public key using a command rather than from a text editor (nano in my case):

pbcopy < ~/.ssh/id_rsa.pub

replacing, if necessary, id_rsa with my specific key name. The above command works on OSX. Other systems require a different command, and they are listed on the following page: <http://doc.gitlab.com/ce/ssh/README.html>;.

Solution 6 - Gitlab

My SSH key was stored in an old Gitlab account, I removed it and problem solved.

Solution 7 - Gitlab

In my case I already had the public key added on another repo.

Fix:

  1. On the same GitLab page (Settings -> Repository -> Deploy Keys)
  2. Scroll down and click to the TAB "Privately accessible deploy keys"
  3. Find your "Deploy key" in the list and click the Enable button

Then you are good to go.

Solution 8 - Gitlab

Text editor could be the problem. Try to open key file with Notepad, not Notepad++.

Also add "ssh-rsa " at the beginning of the key.

Solution 9 - Gitlab

Make a New Key

None of the above solutions worked for me so I backed up my old key and created a new one.

https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/

#osx10.12.6

Solution 10 - Gitlab

In my case, my public key must have somehow been attached to a specific repository.

I went back and deleted two old repositories and after that it allowed me to add the public key to my GitLab account without any problems.

Solution 11 - Gitlab

Add new ssh key The pervius ssh key probabley use by another user . When somone else use a ssh key you must get this error dint worry create a new ssh key and use theme.

Solution 12 - Gitlab

In the same gitlab setting page where you tried to add the deploy key scroll down a little bit and you shall find a tab called "Privately accessible deploy keys". Click it and you shall find the key you tried to add listed there. Just click "Enable" from next to it and it would work !

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionlearn_developView Question on Stackoverflow
Solution 1 - GitlabManeesh PariharView Answer on Stackoverflow
Solution 2 - GitlabUnkasView Answer on Stackoverflow
Solution 3 - GitlabMenno BieringaView Answer on Stackoverflow
Solution 4 - GitlabLincoln LemosView Answer on Stackoverflow
Solution 5 - GitlabherrtimView Answer on Stackoverflow
Solution 6 - GitlabSinan EldemView Answer on Stackoverflow
Solution 7 - Gitlabthanos.aView Answer on Stackoverflow
Solution 8 - Gitlabcell-inView Answer on Stackoverflow
Solution 9 - GitlabJacksonkrView Answer on Stackoverflow
Solution 10 - Gitlabspencer.smView Answer on Stackoverflow
Solution 11 - GitlabHossein ShafieiView Answer on Stackoverflow
Solution 12 - GitlabAhmed HamadView Answer on Stackoverflow