Skip to content

Fix #69: Auto-accept GitHub SSH host key on fresh installations#71

Closed
HalBowman wants to merge 1 commit intomainfrom
fix/ssh-known-hosts
Closed

Fix #69: Auto-accept GitHub SSH host key on fresh installations#71
HalBowman wants to merge 1 commit intomainfrom
fix/ssh-known-hosts

Conversation

@HalBowman
Copy link
Collaborator

Summary

  • Added ensureGitHubHostKey function that automatically whitelists GitHub's SSH host key before git clone operations
  • The function runs ssh-keyscan github.com to fetch and add the host key to ~/.ssh/known_hosts
  • Only adds the key if not already present to avoid unnecessary I/O

Problem

When flock is set up on a new machine for the first time, the first git clone when adding a new repository fails because the SSH host keys are not whitelisted. This requires manual intervention to accept the host key.

Solution

Before performing any SSH-based git clone (in cloneOrGetRepo), the code now ensures GitHub's SSH host key is in the known_hosts file. This prevents "Host key verification failed" errors on fresh installations.

Testing

  • Verified the code compiles successfully
  • The function is idempotent - it only adds the key if not already present

Fixes #69

@RaghavSood RaghavSood closed this Mar 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Git clone error on fresh flock installation

2 participants