Search code examples
windowsgitsshbitbucket

Setting up SSH keys for Bitbucket on Windows


First, I am an absolute noob with git, repos and command line. I have repo on Bitbucket and I basically want to be able to push to the repository via gitbash without entering a password each time.

What I have:

  • A repository on Bitbucket with the code already set up.
  • A local directory where the repository is cloned.
  • A public key and a private key generated via PuTTY.
  • Public key added to Bitbucket via the Manage SSH keys page.

How do I now make it work so that I don't have to enter the password each time I push from the gitbash terminal? I'm using Windows 10.


Solution

  • Please follow the steps to add ssh key into bitbucket account to solve your issue.

    1. Open git bash terminal and enter the command ssh-keygen -t rsa -C "your email address"
    2. Enter passphrase (leave it blank) and enter
    3. Enter the same phrase again (leave it blank) and enter
    4. Copy the id_rsa.pub file content from where it is residing in your system (C:\Users\username\.ssh)
    5. Login to bitbucket account and click top right most user icon ->bitbucket settings->ssh keys under security menu then paste into key field and save it.
    6. Restart your git bash terminal and enter git init command and add ssh git repository location git@bitbucket.org:username/repository_name.git which is present in your bitbucket repository.

    Enjoy!