Can't git push to Bitbucket: Unauthorized - fatal: Could not read from remote repository

I was able to solve this using this suggestion:

  1. Remove the SSH key from the repo. (Click on repo name > Settings > Access Keys)
  2. Add SSH key to Account settings SSH keys. (Click on your avatar > Personal Settings > SSH Keys)

So, adding the keys under the repo only gives you a read-only access. For read and write access, you need to add your keys under your account.

To be fair, Bitbucket warns about the read-only access when adding the key to the repo: image showing the bitbucket message warning about the read-only access