Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

setting up ssh-keys for bitbucket account (with mac osx)

I have a BitBucket account. Despite setting up the ssh key on the computer and then adding it on my bitbucket account, I fail at connecting:

$ git clone [email protected]:my-account/myrepo.git 
Cloning into 'myrepo'...
conq: repository does not exist.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

I did the following:

$ cd ~/.ssh

$ ssh-keygen -f ~/.ssh/my-key -N ''

$ vim config
Host bitbucket.org
  HostName bitbucket.org
  IdentityFile ~/.ssh/my-key

$ ls -l
-rw-------  1 me  ...   229 Jul  8 15:50 config
-rw-------  1 me  ...  1679 Jul  8 14:07 my-key
-rw-r--r--  1 me  ...   411 Jul  8 14:07 my-key.pub

Then I added the content of my-key.pub in my bitbucket account's ssh keys. Then I retried cloning my repository:

$ git clone [email protected]:my-account/myrepo.git 
Cloning into 'myrepo'...
conq: repository does not exist.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

I repeated the identical procedure on another machine, it worked:

$ git clone [email protected]:my-account/myrepo.git
Initialized empty Git repository in /home/me/.ssh/myrepo/.git/
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (3/3), done.

I need to do the same on my first machine now. As a last resort, I followed some advises on the net using the ssh-agent:

$ eval `ssh-agent -s`
$ ssh-add ~/.ssh/my-key

But still no luck:

$ git clone [email protected]:my-account/myrepo.git 
Cloning into 'myrepo'...
conq: repository does not exist.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

I have no idea what is different on the first machine, why does it reject my request?


EDIT 1

Of course I tried doing it the very basic way, as suggested by D.Samchuk:

Generating the id_rsa

$ ssh-keygen -t rsa
enterx3

Copied the exact content of the key

$ cat ~/.ssh/id_rsa.pub

And I added id_rsa.pub's content in my BitBucket account's ssh keys.

Git clone will still not allow me to access the repository, whit the same output error message as above.


EDIT 2

I have no idea maybe it is related to mac configurations? Since The other machine is a redhat linux I just wondered but couldn't find any reported similar issue.

like image 605
kaligne Avatar asked Jul 08 '16 14:07

kaligne


2 Answers

just do following:

$ ssh-keygen -t rsa

name: id_rsa

passphrase: just press enter twice to avoid print keyword everytime you connect

$ cat ~/.ssh/id_rsa.pub

copy output

open bitbucket --> profile --> bitbucket settings --> add ssh key --> paste your output

like image 142
D.Samchuk Avatar answered Oct 21 '22 16:10

D.Samchuk


If you are not using a passphrase for the ssh key you shouldn't need the ssh-agent

https://help.github.com/articles/working-with-ssh-key-passphrases/

like image 26
despadina Avatar answered Oct 21 '22 14:10

despadina