Brew update error

How to fix unability to update brew

Posted on 2017-10-12 11:33:16

Recently I faced the following error:

~ brew update
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Error: Fetching /usr/local/Homebrew/Library/Taps/homebrew/homebrew-services failed!
Fetching /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core failed!
Fetching /usr/local/Homebrew/Library/Taps/caskroom/homebrew-cask failed!

As I found at this thread https://github.com/Homebrew/brew/issues/1185 the problem is that

If you've upgrade to macOS Sierra there's a known issue (which seems deliberate on Apple's part) where it no longer reads your SSH passphrase from the Keychain, so every time you reboot you have to manually ssh-add -A if you fetch stuff from Git over SSH, otherwise you will see issues like that

So basic ssh-add -A should fix this issue.