Recently, Bitbucket retired the simple password login via git-https. So we will need a ssh-key on it. I thought it was not a big deal but later I realized there are some tricky points to deal with this combination.

Following are the tips to save time.

First: Check the SSH config

In windows, this config might missing or not generated properly. Better to check add .config into the .ssh folder after using ssh-keygen.

Host bitbucket.org
    User git
    Hostname bitbucket.org
    PreferredAuthentications publickey
    IdentityFile ~/.ssh/{id_rsa}

Second: GIT config

Make sure .config in the .git folder is as following.

[remote "bitbucket"]
url = git@bitbucket.org:{acc}/{repo}.git
fetch = +refs/heads/*:refs/remotes/bitbucket/*

Finally: Adding the KEY in Bitbucket

This one is surprisingly tricky in bitbucket. It is actually funny that there are 3 entry points of adding public SSH key into your repo. You need to go personal setting to add key otherwise it will fail while pushing the code. And … if you are adding the key by repo-setting or project-setting, I am talking about you.