SSH Key error while pushing info to BitBucket

Venkata S. Vellanki June 10, 2015

When I used Ruby on Rails to create sample project on my virtual machine using Ubuntu, I created an SSH key and saved in the folder ~/.ssh/id_rsa.pub

I have also saved this SSH key on Bit Bucket.

But error of invalid key comes when try to push this.

When I use cloud environment for ROR projects, I could push the information of the project to Bit Bucket without any error.

Also in Ubuntu 2 separate SSH keys were created probably when I was in 2 different directories like ~/workspace or ~/workspace/hello_app

I however uploaded both the SSH keys on Bitbucket.

 

So how to resolve the error when trying to push the info to Bitbucket repository from my virtual machine using Ubuntu.

 

 

4 answers

0 votes
Venkata S. Vellanki June 11, 2015

I found out the error. When I generated key while in ~/.ssh/ instead of generating it while in another directory,  the key started working and I could push the info to repository. Thank you.

0 votes
rrudnicki
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 11, 2015

Hi Venkata, 

Can you let us know what happens when you run the following command?

$ ssh -T git@bitbucket.org

This might not be your case, but as a quick test, what happens if you run the push command using sudo in front of?

 

Also, this can happen due to a variety of reasons such as 1) your public key not loaded in your Bitbucket account 2) your key not loaded onto your ssh-agent etc.

This document does a good job of walking you through the process of troubleshooting your problems. There is a specific section for the Permission denied (publickkey) error as well that you might find useful.

 

Regards, 

Renato Rudnicki

0 votes
Venkata S. Vellanki June 10, 2015

I am getting the following error:

~/workspace/hello_app$ git push -u origin --all

Permission denied (publickey).

fatal: Could not read from remote repository.

 

Please make sure you have the correct access rights

and the repository exists.

I created the key as follows and copied the public key to the directory  ~/.ssh/ :

$ ssh-keygen -t rsa (this command was made while in home directory)

Generating public/private rsa key pair.

Enter file in which to save the key (/home/venkata/.ssh/id_rsa): id_rsa

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in id_rsa.

Your public key has been saved in id_rsa.pub.

and then using cat command, displayed and then copied to Bitbucket. The repository hello_app was created in BitBucket. Presently this repository is empty.

 

 

 

 

 

 

 

 

 

 

0 votes
Boris Berenberg
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 10, 2015

What is the actual error you are getting?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events