Issue
I'm using Mac OS 12.4 and I ran into an issue while running any kind of git command that causes the following error:
/Users/user/.ssh/config: line 3: Bad configuration option: usekeychain
/Users/user/.ssh/config: terminating, 1 bad configuration options
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Oddly enough, the error only happens in the zsh shell and not when using bash.
Trying to solve it, I followed the GitHub documentation and added IgnoreUnknown UseKeychain
in my ssh config. However that did not solve my problem.
Finally, I managed to fix the issue by removing the UseKeychain true
line from the .ssh/config
file but I'm afraid that it might backfire in unexpected ways.
What are reasonable alternatives to solve this problem?
Solution
The UseKeychain
option will store the passwords associated with private keys in the user's keychain so that they don't need to enter them each time the key is used for login. Removing the option simply means that you will be prompted to enter the password at the command line whenever one is required to decrypt a private key.
The source of your error is likely a version mismatch between multiple OpenSSH versions. I'd open a zsh prompt and a bash prompt and try which ssh
and see if they are both using the same binary. ssh -v
may also yield useful information.
You could also add the following line to the top of your .ssh/config file and not worry about it.
IgnoreUnknown UseKeychain
This will simply ignore the UseKeychain entry on any binary version or OS on which it is unsupported, and still use it on any systems that do.
Answered By - Nilpo Answer Checked By - Willingham (WPSolving Volunteer)