As mentioned in this BitBucket thread:
By using
sudo ssh
will look forroot
's keys, not yours in/home/username/.ssh/
.
You probably shouldn't be running git with sudo.But if you really need to, generate some new keys under the
root
account and upload those to Bitbucket.
Or you can try sudo -E
, to preserve your environment, as mentioned in "Git SSH public key denied".