Step 1: Create public and private keys using ssh-key-gen on local-host
On your local machine you need to create ONCE the ssh key-pair:
ssh-keygen -o -t rsa -C "email@example.com" -b 4096 -N '' -f $HOME/.ssh/id_rsa
Copy the public key to remote-host using ssh-copy-id
ssh-copy-id -i ~/.ssh/id_rsa.pub RemoteHost
you need to enter the password of the remote host once.
Login to remote-host without entering the password
Fix offending key in local store
change the linenumber resp. the ip address before applying the command below
remove 10th line:
sed -i '10d' ~/.ssh/known_hosts
If you already have ssh key on your machine then type the following command to retrieve the public key:
ssh-keygen -o -t rsa -C "firstname.lastname@example.org" -b 4096
Enter passphrase and store it in the keypass file.!
Go to GitLab pages and navigate to the ‘SSH Keys’ tab in your ‘Profile Settings’. Paste your key in the ‘Key’ section
and give it a relevant ‘Title’. Use an identifiable title like ‘Work Laptop – Windows 7’ or ‘Home MacBook Pro 15’.
If you manually copied your public SSH key make sure you copied the entire key starting with ssh-rsa and ending with your email.
Click on your profile picture (top right) and select “Settings”.
On the Menu on the left side you see „SSH and GPG keys.
You can store your public key there.
copy from server