Git on bitbucket always asks for password

I noticed that even after adding my public ssh key to Bitbucket, it asks for my password, and dies with an “fatal: Authentication failed”, if I dont give it the password. Obviously typing out the password is tedious, esp if you have a 40 letter complex password. 🙂

Reason:

You cloned the repo using https:// link instead [email protected] link.

Solution:

Change your remote URL: Error message:

#git push origin master
Password:
fatal: Authentication failed

You can first check if this is the case, by listing out your remotes, with:

#git remote -v
origin  https://[email protected]/droidzone/securessh.git (fetch)
origin  https://[email protected]/droidzone/securessh.git (push)

Now, change the remote for “origin”, with:

#git remote set-url origin [email protected]:droidzone/securessh.git

Now, try again:

#git push
Warning: Permanently added the RSA host key for IP address '' to the list of known hosts.
Everything up-to-date