Gitlab ssh key pair

In this tutorial, I’m want to use SSH keys to interact with git my project. How to generate Gitlab ssh key for your account.

How to do it

If you do not have an SSH key pair, then error message as below:

$ cat ~huupv/.ssh/id_rsa.pub
 cat: /home/huupv/.ssh/id_rsa.pub: No such file or directory

To generate a new ssh key pair

$ ssh-keygen -t rsa -C "huupv@devopsroles.com" -b 4096

The output Gitlab ssh key pair as bellow

Generating public/private rsa key pair.
 Enter file in which to save the key (/home/huupv/.ssh/id_rsa):
 Created directory '/home/huupv/.ssh'.
 Enter passphrase (empty for no passphrase):
 Enter same passphrase again:
 Your identification has been saved in /home/huupv/.ssh/id_rsa.
 Your public key has been saved in /home/huupv/.ssh/id_rsa.pub.
 The key fingerprint is:
 2a:16:6d:94:35:a2:02:db:2c:ce:fb:4f:79:56:bf:0b huupv@devopsroles.com
 The key's randomart image is:
 +--[ RSA 4096]----+

To generate 2 files as below:

Private key: id_rsa
Public key: id_rsa.pub

I already have ssh key pair to create on my laptop.

$ cat ~/.ssh/id_rsa.pub

The content public key id_rsa.pub as below:

ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAgEAwEts938rLe7B1KKgYYBrhCMHFzeumk1IaoVo3rD48qVCig8fCHvp+W3Z2UzHHS9iT1IscXi0Bxq+/fTO9cbB5EznGTIW3I7y26yzIq/6iv3I/biYMmi6EiWCd2Ed2188uZ9aR0+gN4QIAmU8Grh91eaEy04d9H67GF2UT3lqx3PEi7v7aIH6FdkCdOp2YIE25UTuJoMoZ3kjKo02tGP7y/PUw8lbm/ezvYFLBN5l5DfmebDwSBNrR/K84mLWGx3L/bB9XnkEZRSh2vi+YFQ5FMomJA8+RHzfUS5zV3tI8VFDe1bGvcpYxKLKGc1bfKBZSYsOpsKgOofBcENaOJ8l0xCLWMFbJkAKcLEFuwBpLTx75WF7MEaxBnEIWekhhBR5hC+cR2fKEYuZaOYmpBfZUGnIDadad83+3qOQs+50/11AoinHCBOEphWRbn6pk0JP+pyTDsRKEmZ4KNOJt/WNwfVMnCVKb/5wcwCrmQ8ztWilcjT0UdMYUoH4u2IidWV5F38vAdG+LNH5dmKr2pcI7CdgZSXQqppkrvcqMLeH2BprlxuJW8qLc1hYV6HhWYbJc3EX28a6mZfohXLQAgN8HVpBaQ9UAZ33MiDPUhHeIW1OeXSXQHgH5t0CjXqzg3G9/vM7qOUr/27kN+D0ExBPENQf7hZ5Aw24fJl/PLQHAHs= huupv@devopsroles.com

To copy and paste the content id_rsa.pub to the Profile Settings in Gitlab server web interface

Conclusion

Thought the article, To help you use ssh key pair for the project. To generate ssh key pair for the account.

, ,

About HuuPV

My name is Huu. I love technology and especially Devops Skill such as Docker, vagrant, git so forth. I likes open-sources. so I created DevopsRoles.com site to share the knowledge that I have learned. My Job: IT system administrator. Hobbies: summoners war game, gossip.
View all posts by HuuPV →

Leave a Reply

Your email address will not be published. Required fields are marked *

Comment moderation is enabled. Your comment may take some time to appear.

This site uses Akismet to reduce spam. Learn how your comment data is processed.