3

I want to take pull from my bitbucket repo without asking the password every time. I am using Ubuntu 16.04 LTS

Steps,

$ssh-keygen

It generated two key files, id_rsa and id_rsa.pub

Then, in the Bitbucket repo settings, I have added the ssh key of the server.

$cat ~/.ssh/id_rsa.pub

But it is not working. It is still asking for password.

Dinesh Ahuja
  • 925
  • 3
  • 15
  • 29
  • Could [this](https://stackoverflow.com/questions/3466626/add-private-key-permanently-with-ssh-add-on-ubuntu?rq=1) be of any use? I hope so. – Romain Valeri Aug 20 '18 at 07:26

3 Answers3

3

The problem could also be that the ssh-agent is not using the key yet. I had this once and spend some time not mentioning this. Please try to run

ssh-add ~/.ssh/id_rsa

and than try again to checkout...

Sascha Effert
  • 2,352
  • 2
  • 14
  • 10
1

Bitbucket have a pretty good tutorial explaining how to set up an ssh key.

If you have carefully follwed this (especially the ssh-agent part), maybe you need to update your config.

In your cloned repo you have a .git folder with a config file Inside. Open it and check that you have an ssh url.

You should see somehing like :

[remote "origin"]
    url = ssh://git@bitbucket.org:<username>/<repoName>.git

Here another bitbucket tutorial that explained it.

user43968
  • 2,049
  • 20
  • 37
1

I had to add the key file in ~/.ssh/config

Host bitbucket.org
 HostName bitbucket.org
 IdentityFile ~/.ssh/id_rsa

I also added key id_rsa.pub in the bitbucket repo. It is working fine now.

Dinesh Ahuja
  • 925
  • 3
  • 15
  • 29
  • your `HostName` entry looks redundant and I'd suggest using `ssh-add` as suggested by Sascha Effert – Sam Mason Oct 19 '18 at 17:01
  • @SamMason ssh-add works but when you relog into server you have to do ssh-add again. Not very helpful unfortunately. – trainoasis Aug 08 '19 at 08:22