Ray
Ray

Reputation: 1828

SSH push to Bitbucket using generated keys on Windows 7

I follow documentation on Bitbucket site and would like to push existing project to remote repository by ssh. I perfomed next steps in CMD:

  1. I generated public and private key using puttygen
  2. Added private key using pageant
  3. Added ssh config file inside ~/.ssh
  4. Added public key to bitbucket

When I try to execute:

git push -u origin --all

I get stacktrace:

Enter passphrase for key 'k:\path\private_work_key.ppk':
Enter passphrase for key 'k:\path\private_work_key.ppk':
Enter passphrase for key 'k:\path\private_work_key.ppk':
Permission denied (publickey).
fatal: Could not read from remote repository.

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

I even added the public key to the ~/.ssh/authorized_keys , but the problem remains.

Please, Could someone explain what I did wrong?

Upvotes: 2

Views: 1428

Answers (2)

mnokka
mnokka

Reputation: 31

I had issues with "Permission denied (publickey)" with WIN7x64. Here is a short list to get it working, most important being the plink.exe usage!

1) Keypair creation using PuttyGen

2) Store public key to Bitbucket (Manage account / SSH Keys)

3) Change used BitBucket repository to use SSH authentication

4) Use Windows Pageant as a SSH authentication agent

5) Define remote git repository to use SSH authentication (git remote add [email protected] :< accountname>/< reponame>.git)

6) Define GIT_SSH=plink.exe as a Windows shell variable. Now git push/pull/etc commands are passing the SSH authorization

Upvotes: 0

Nasik Shafeek
Nasik Shafeek

Reputation: 961

The following scenario worked for me,

First add the key to your ssh agent,

ssh-add path/to/your/privatekey

and then, start the ssh-agent

ssh-agent

Now try pushing your project into your repository.

Upvotes: 2

Related Questions