Sunday, December 29, 2013

GitLab SSH

GitLab HELP instructions on how to connect GitLab with SSH seems not to be 100% complete.
What it mentions is:

SSH Keys

SSH key allows you to establish a secure connection between your computer and GitLab
To generate a new SSH key just open your terminal and use code below. 

ssh-keygen -t rsa -C "user@example.com"
# Creates a new ssh key using the provided email
# Generating public/private rsa key pair...
 
Next just use code below to dump your public key and add to GitLab SSH Keys 

cat ~/.ssh/id_rsa.pub
# ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC6eNtGpNGwstc....
 
When I tried this and uploaded public RSA key to my GitLab profile i still got error when trying 'git push':

Agent admitted failure to sign using the key.
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

So i read somewhere that missing part is to execute:

ssh-add ~/.ssh/id_rsa

Now SSH connection works fine.

No comments:

Post a Comment