0%

Fix Git SSH Permission Denied After Upgrading to macOS 13 Ventura

After upgrading to macOS 13 Ventura, I suddenly found that git push stopped working and failed with:

1
2
Permission denied (publickey).
fatal: Could not read from remote repository.

After repeatedly confirming that my public key was still present on GitLab, I found discussions مثل this one:

https://superuser.com/questions/1749364/git-ssh-permission-denied-in-macos-13-ventura

The likely cause is that the bundled OpenSSH_9.0p1 in macOS 13 disables RSA/SHA-1 by default.

There are two main ways to fix it.

Option 1: Generate a new key

This is the cleaner option, though it can be more expensive if you need to update the key in multiple places:

1
ssh-keygen -t ed25519

Option 2: Re-enable RSA in SSH config

Edit ~/.ssh/config and add:

1
2
3
Host *
HostkeyAlgorithms +ssh-rsa
PubkeyAcceptedAlgorithms +ssh-rsa

This can also help when the remote server is too old to support newer algorithms.

如果我的文字帮到了您,那么可不可以请我喝罐可乐?