How to Create and Setup SSH Authentication for BItbucket and Github
- Last Updated On: December 18, 2016
- By: Scriptcrunch Editorial
I want to setup ssh authentication keys for my GitHub and Bitbucket account. So that I can commit to those repositories without username and password. How can I achieve this?
Solution: You can setup a passwordless authentication to your repositories on Github and Bitbucket using ssh keys. Follow the steps given in this article carefully to set it up.
Create a Key Pair
First, you need to create a key pair using OpenSLL utility.
1 .CD in to .ssh folder of your system.
cd ~/.ssh
2. Create a public and private key pair. When prompted for options, just press enter to select the default options. Optionally you can set a passphrase for your key.
t
3. Copy the public key.
cat id_rsa.pub
4. Head over to Github or Bitbucket settings page and in the ssh keys option, add the id_rsa.pub contents that you have copied.
5. Once you are done with adding the keys, you can test the ssh connection using the following commands. First time it will ask to accepts the fingerprint.
For bitbucket,
ssh -T [email protected]
For Github,
ssh -T [email protected]
Cloning Repo
An important thing to notice when cloning the repo is, you should clone the repo with ssh URL and not the https URL. If you clone with https URL, ssh authentication won’t happen and it will ask for username and password.
For example,
git clone [email protected]:devopscube/example.git
That’s it. Now you will be able to push to your repository without username or password.
Scriptcrunch Editorial
Other Interesting Blogs
[80% OFF] Linux Foundation Coupon for December 2024
Looking for CKA Coupon and other Linux Foundation certifications coupons? We got you covered. With the latest Linux Foundation Coupon, you can
[65% OFF] Linux Foundation LFCA, LFCS & LFCT Exam Voucher Codes
Linux Foundation has announced up to a $284 discount on its Linux certification programs Linux Foundation Certified IT Associate (LFCA) and Linux
Best Black Friday Deals For Techies in 2024
In this blog, we have listed down all the best Black Friday deals and Cyber Monday deals for techies. This is the