Git PublicKey denied on Mac OS X Sierra

If your Git publickey is denied to connect to your remote host (by pulling, pushing, etc.), first, check if you have actually an error to connect to your host:

If your SSH key is the issue, you should get this message:

Since Mac OS Sierra, the keychains are not autoloaded and must be explicitly called. So we will check if your keys are stored in the ssh-agent:

Verify in the list if you have your SSH key needed for your repository. If you don’t have any key, you will get this message:

To fix this issue, you will just have to add your SSH key in the ssh-agent with this command line:

A Reddit post on the subject with a permanent solution : difficulties with ssh-agent in macOS Sierra