My Profile Photo

Deviant Syndrome


coding, multimedia, gamedev, engineering


SSH Agent under MacOS Ventura

After upgrading to MacOS Venture I had a bit of a problem with the SSH agent. This problem, though, could still be related to the interface between the monitor and the chair, as we developers like to say.

I’m using multiple SSH keys, mainly to distinguish between my personal and work GitHub accounts. Git has a nice option for that, btw:

export GIT_SSH_COMMAND='ssh -i ~/.ssh/personal_github_rsa -o IdentitiesOnly=yes'

After the upgrade, I migrated the SSH keys from the old machine. Manually. I mean, like scp-manually. Don’t ask me why I did not use the standard migration tools . Believe me, that are something things behind those slick silver facade, that you don’t want to know about. But to imagine the horror I will just say, that the experience with migration tools for my platform made me really miss CloneZilla.

Anyway, back to the topic. After the migration, when I tried to push something to my personal GitHub repo, I got the authentication error. So, I had to add the key to the agent. I did it like this:

eval "$(ssh-agent -s)"
ssh-add -K ~/.ssh/personal_github_rsa
ssh-add -l

The -K option was specific to macOS and adds the specified identity file to the Keychain, which is the secure password management system on macOS.

Lately, I also stumbled upon this:

WARNING: The -K and -A flags are deprecated and have been replaced
by the --apple-use-keychain and --apple-load-keychain
flags, respectively.  To suppress this warning, set the
environment variable APPLE_SSH_ADD_BEHAVIOR as described in
the ssh-add(1) manual page.

So, probably, it is better to use the new options:

ssh-add --apple-use-keychain ~/.ssh/personal_github_rsa