How to add ssh security to Git
SSH security is used for making your repositories secure with a public key that means only those users will make a change or read your repositories who have your ssh key. You can change your ssh key also.
Step 1. Check you have ssh installed or not
Use command ssh -V or ssh -v and if you don’t have ssh then first install it.
Step 2. Setup identity
Start terminal where you want to save the key. Then, Use command ssh-keygen to generate rsa key.
Enter file name after id_rsa where you want to save key and if you don't want to specify any file name then leave it as it and press enter.
You’ll get the message to override key if you have already generated. Otherwise, it will simply ask to enter the passphrase. Now you can see the terminal response.
If you found the response shown in the above screenshot, it means your ssh key is generated.
Now, You can check ssh list using ls -a ~/.ssh this command. Then you will get the result would be something like below.
Step 3. Start ssh-agent
To check agent is running or not type command
ps -e | grep [s]sh-agent
and if isn’t running use command below and check it again,
ssh-agent /bin/bash
Now, To load your new identity. Use the command given below.
ssh-add ~/.ssh/id_rsa
Now, to get the list of the keys that agent is managing. Use the command given below.
ssh-add -l
Step 4.Now open bitbucket account.
Go to your bitbucket account > bitbucket setting. As shown in the figure below.
You may have found security > ssh keys. Click on ssh keys.
click on add key.
Now go to your terminal again and type command.
cat ~/.ssh/id_rsa.pub
Copy key using the command given below.
cat ~/.ssh/id_rsa.pub | xclip - sel clip
Or directly from the terminal and paste it to Key in popup menu on your bitbucket account.
Add the label and paste your key and press add the key.
Update your repositories type from https to ssh.
ssh://git@bitbucket.org :account/repo.git
About Emipro
Being an emerging leader in IT market since 2011, Emipro Technologies Pvt. Ltd. has been providing a wide range of business solutions in Odoo & Magento. We are pleased to have a large pool of contented customers with our meticulous work in the domain of ERP & e-Commerce. Our customers are companies of all sizes ranging from startups to large enterprises who realize that they need a professional internet solution to generate revenue streams, establish proper communication channels, to achieve desired goals and streamline business operations. [....] Read More
Our writings seems informative ?
Subscribe for our Odoo Technical Notes and get more amazing stuff directly to your inbox!
Post Your Review
