How do I add an SSH key in gitlab?
Go to your GitLab account: https://gitlab.com/
Click on Settings on the top right drop-down, which will appear once you select the icon(white-fox image [specific to my profile]).
Click on Settings on the top right drop-down, which will appear once you select the icon(white-fox image).
Click on SSH Keys:
Add/Paste the SSH Key.
How to generate the ssh key: Download gitbash or putty:
After downloading gitbash/putty follow the steps:
- Open a terminal on Linux or macOS, or Git Bash / WSL on Windows.
Generate a new ED25519 SSH key pair:
ssh-keygen -t ed25519 -C "[email protected]"
Or, if you want to use RSA:
ssh-keygen -t rsa -b 4096 -C "[email protected]"
It will generate the key in => C:\Users\yourname.ssh directory.
Copy the public key and paste in the gitlab location:
Command to run on gitbash to clone the repository:
ssh-agent $(ssh-add C:\Users\youname\.ssh\id_rsa; git clone [email protected]:xyz/SpringBootStarter.git)
Just follow the official guides to Create and Add SSH keys.
- You need to sign in. Green button top right.
- Click 'profile settings' on the left side menu.
- Click SSH Keys and follow the instructions on the page.