Tuesday, February 8, 2022

Git: Windows: Failed to add the host to the list of known hosts


>PROBLEM

Attempt to a Git operation over remote repository returns the following message:

Could not create directory 'your path here' (No such file or directory).
Failed to add the host to the list of known hosts (/your local path here/known_hosts).

See picture where it points to "issue".




>SOLUTION#1

Set the envvar GIT_SSH.

GIT_SSH=$YOUR_PATH/.ssh/known_hosts
If linux, use export cmd.

If Windows, use sysdm.cpl, Advanced tab, Environment Variables.
Reopen the console and check:
echo %GIT_SSH%

>SOLUTION#2

1. Open Git Bash console.




2. Perform the command below to enable read and write;

chmod 776 your local path here/known_hosts






3. Keep the git bash console opened, test running a git command again.
For instance:

git ls-remote


The problem is gone as the figure shows where it points to "solved".




>ENV

Windows 10




[REF]: faq-Failed to add the host to the list of known hosts

No comments:

Post a Comment

eclipse: java: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder" or Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/impl/StaticLoggerBinder

  >PROBLEM Using Eclipse, you try to run a simple logging test using "org.slf4j.Logger" like the sample below: package Test; im...