I have generated SSH keys using PuttyGen (priavte key is saved as "private.ppk" under .ssh folder). I have added the public key to my organisation Bitbucket's SSH key section. If I try to do any git operations using SourceTree, its working fine. But If I try to do anything from GitBash or from IntelliJ Idea, it gives the following error
git@bitbucket.companyname: Permission denied (publickey). fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
Used "SSH-2 RSA key" option when generating the keys.
That means your GIT_SSH
environment variable does not reference plink.exe
(assuming Windows here).
But another approach would be to generate your SSH key (without passphrase at first for testing) with openSSH instead of putty:
ssh-keygen -t rsa -P"" -m PEM
That will generate the default %USERPROFILE%/.ssh/id_rsa(.pub)
private/public key
Register the public key to your account, and try again.
Then make sure SourceTree is configured to reference OpenSSH, not PuTTY.