2

Following the macOS update (to Monterey 12.6.1) my ssh authentication stopped working. I was getting a "Repository not found. Please make sure you have the correct access rights."

I have reset my ssh setup and followed Github's official guidelines on link

My current ~/.ssh/config looks like this:

Host *.github.com
  AddKeysToAgent yes
  UseKeychain yes
  IdentityFile ~/.ssh/id_ed25519

I now get a new error that I haven't been able to solve. When I run ssh -T git@hostname, I get "Bad configuration option: usekeychain"


I have tried the following fixes:

  • Adding to config: IgnoreUnknown UseKeychain
  • Adding to config: IgnoreUnknown AddKeysToAgent,UseKeychain (link)
  • Clearing DNS cache: sudo killall -HUP mDNSResponder
  • Removed ~/.ssh/known_hosts
  • Changed hostname to Host *
3
  • Were you using some replacement OpenSSH? Commented Nov 8, 2022 at 17:07
  • No, using OpenSSH_9.1p1, OpenSSL 1.1.1s
    – P. Alves
    Commented Nov 8, 2022 at 21:38
  • I wondered because it got UseKeychain from somewhere. Commented Nov 8, 2022 at 21:42

1 Answer 1

0

I had a similar issue to this when I had accidentally written over my public and private key. To overcome and reset this I

  1. Deleted all github related ssh keys from the key chain and .ssh/ directory.
  2. Deleted github ssh key from github ui.
  3. Ran ssh-add -D to remove all identities from the agent.
  4. Re-created the ssh key and saved the public key on github.

Obviously this is quite heavy handed!

2
  • Thanks, Simon, this is perfect! Solution number 3 solved my issue. I think that one of the identities from the agent was cached and that is what was causing the whole issue. ssh-add -D solved this issue!
    – P. Alves
    Commented Nov 9, 2022 at 10:56
  • exactly the same happned to me with 12.6.2 update (maybe earlier. only experienced it today) ssh-add -D solved all annoying git issues. Thanks!
    – taiyodayo
    Commented Feb 27, 2023 at 12:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .