Software⏱️ 2 min read📅 2026-05-31

How to Fix: Failed to add the host to the list of know hosts

Failed to add host to know hosts in Git Bash on Mac OSX Lion 10.7

Quick Answer: The issue is likely due to the fish shell installation. The 'ssh-agent' process is not running, which is required for key authentication.

The 'Failed to add the host to the list of known hosts' error on Mac OSX Lion can be frustrating, especially when trying to connect to GitHub. This issue often arises due to misconfigured SSH settings or incorrect host fingerprinting.

🛑 Root Causes of the Error

  • Incorrect host fingerprinting due to untrusted or missing SSH key exchange.
  • Failed SSH key generation or invalid private key files.

✅ Best Solutions to Fix It

Method 1: SSH Key Generation

  1. Step 1: Open a terminal on your Mac and type the command `ssh-keygen -t rsa -b 4096` to generate a new SSH key.

Method 2: Update Host File

  1. Step 1: Copy the correct SSH host fingerprint and add it to your Mac's `~/.ssh/known_hosts` file using a command like `echo 'sha256:your-fingerprint-here' >> ~/.ssh/known_hosts`.

🎯 Final Words

By following these steps, you should be able to resolve the 'Failed to add the host to the list of known hosts' error on your Mac OSX Lion and successfully connect to GitHub.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions