Remove SSH key from Git Bash

Hello,

I followed informations on this page:
https://docs.gitlab.com/ee/ssh/README.html#generating-a-new-ssh-key-pair

I’m using Git Bash, so I added my SSH Key with the following command:

cat ~/.ssh/id_ed25519.pub | clip

But what if I want to remove the association with the key? How can I remove it?
Thank you

HI,

these key pairs should be located in your user home directory in a folder called .ssh. This is the same on Linux/Unix.

Cheers,
Michael

Hello,
Yes, the files are located in my home folder/.ssh

But the command “cat ~/.ssh/id_ed25519.pub | clip” add it in someway (I do not know wat exactly is the clip

With the ssh key just in the folder, the push was not working on the Gitlab server. I had to “add” it in the clip with the previous command.

I would like to keep the file, but remove it from my Git Bash configuration

Hi,

ok then sorry for the confusion. I didn’t fully read the docs here. I normally use an editor on Windows for getting access to the content.

  • cat ... | clip copies the public key content into your Windows clip board for copy paste. That is similar to what when you open that file with notepad, ctrl+a, ctrl+c
  • Then the second step is important - Add your public SSH key to your GitLab account by:

There is says to pasting your public key in the Key field.. At this stage, you put your cursor into the field and press ctrl+v to paste the content of the clip board there.

TL;DR - the SSH public key needs to be added to your GitLab account with copying over its textual content.

Cheers,
Michael

PS: Sent a MR for refining the wording in the docs, keeping the clipboard reference between 1. and 2. https://gitlab.com/gitlab-org/gitlab/merge_requests/22188
PPS: In order to delete the key, you’ll need to reverse both steps.

1 Like

Thanks for the MR to improve the documentation @dnsmichi ! :tada:

1 Like

Thanks Michael!
I thought the cat ... | clip was copying the key in a config somewhere!
After that, a copied my key opening the file, “ctrl-c” and paste it in the Gitlab Account. I just didnot understand that the cat ... | clip was just to avoid opening and copiing the file.

Thank you!
Antoine