Git / SSH error 'Permission denied (publickey)' on Mac OS
Usually the problem appears if your key isn't loaded into your SSH agent. You may run into this issue if you've recently restarted your system.
Check to see if your SSH key is loaded:
If you don't see your key listed, add it by entering ssh-add followed by the path to the private key file:
As of macOS Sierra 10.12.2 Apple added an ssh_config option called UseKeychain which allows a 'proper' resolution to the problem. Add the following to your ~/.ssh/config file:
Host * AddKeysToAgent yes UseKeychain yes IdentityFile ~/.ssh/id_rsa_bb