0

I have a repository on BitBucket and I'm trying to use Git GUI to connect to it over SSH and clone the repository to my local folder. I've added a public key (generated in Git) to the BitBucket account (in Setting -> SSH keys).

I copy the clone command from BitBucket (the "Clone this repository" option in the repository's Source page) and paste it to Git GUI. The clone command:

git clone git@bitbucket.org:mycode/myserver.git

Then I press the "Clone" button and get this error:

git clone git@bitbucket.org: Permission denied (publickey).
fatal: Could not read from remote repository.

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

What else am I forgetting here that it doesn't work?

Val
  • 1,548
  • 1
  • 20
  • 36
  • Have you add the private key? You can have more info with `git clone -v git@bitbucket.org:mycode/myserver.git`. Maybe that'll help – AlexandreS Oct 01 '19 at 09:28
  • Where do I add the private key? – Val Oct 01 '19 at 09:36
  • I used the start-ssh-agent.cmd command in Git's installation folder. It generated the files: id_rsa and id_rsa.pub in my local folder C:\Users\username\.ssh\. I think the id_rsa is the private key and Git should know to find it in that location. – Val Oct 01 '19 at 09:41
  • This command only generated both keys but your ssh agent does not know their existence. You can follow this thread: https://stackoverflow.com/questions/18683092/how-to-run-ssh-add-on-windows – AlexandreS Oct 01 '19 at 10:05

1 Answers1

0

ok, so I configured my user account in Git's bash and then typed the clone command and it worked.

Configuring the user:

$ git config --global user.name myusername
$ git config --global user.email myemail@email.com

And then the repo cloning

$ git clone git@bitbucket.org:mycode/myserver.git LocalRelativeFolderName
Val
  • 1,548
  • 1
  • 20
  • 36