# Config file in .ssh not been created which is leading to know\_hosts verification fail

**URL:** <https://discourse.nodered.org/t/config-file-in-ssh-not-been-created-which-is-leading-to-know-hosts-verification-fail/98139>\
**Category:** Industrial\
**Tags:** docker\
**Created:** [15 July 2025 05:35 UTC](https://discourse.nodered.org/t/config-file-in-ssh-not-been-created-which-is-leading-to-know-hosts-verification-fail/98139 "2025-07-15T05:35:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rohitashav-goLang](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rohitashav-golang/32/102039_2.png) [@rohitashav-goLang](https://discourse.nodered.org/u/rohitashav-goLang)\
**Post date:** [15 July 2025 05:35 UTC](https://discourse.nodered.org/t/config-file-in-ssh-not-been-created-which-is-leading-to-know-hosts-verification-fail/98139/1 "2025-07-15T05:35:03Z")

</div>

Hello,

We are running a Node-RED image using Docker, and most of the functions seem to be working fine. However, we're experiencing an issue with Git operations. We have a Git project that we use to store our flows. The problem is that whenever we restart the Node-RED container, the known\_hosts verification fails.

We have mounted the .ssh folder to save the SSH keys, and I have verified that the permissions are fine. However, the same issue persists. In the debug logs, I can see that it's unable to access the config in the .ssh file. Even before the restart, I notice that no config file is being created, so I'm not entirely sure about the root cause.

There is a workaround where we can create a fresh SSH key, and it works. However, I would like to understand what I'm doing wrong in the current setup.

logs :

9 Jul 11:53:19 - [debug] git -c credential.helper= push origin HEAD:main --porcelain

9 Jul 11:53:19 - [debug] [err] Can't open user config file /home/node-red/.ssh/config: No such file or directory

9 Jul 11:53:19 - [debug] [err] fatal: Could not read from remote repository.

9 Jul 11:53:19 - [debug] [err]

9 Jul 11:53:19 - [debug] [err] Please make sure you have the correct access rights

9 Jul 11:53:19 - [debug] [err] and the repository exists.

9 Jul 11:53:19 - [debug] rc=128

---

<div class="post-metadata">

**Author:** ![Serhii\_Korol](https://avatars.discourse-cdn.com/v4/letter/s/58f4c7/32.png) [@Serhii\_Korol](https://discourse.nodered.org/u/Serhii_Korol)\
**Post date:** [18 July 2025 13:33 UTC](https://discourse.nodered.org/t/config-file-in-ssh-not-been-created-which-is-leading-to-know-hosts-verification-fail/98139/2 "2025-07-18T13:33:00Z")

</div>

Hi there,

It sounds like you’re almost there with your setup — thanks for sharing the detailed logs and context, it really helps.  
it seems the Git process is expecting a `config` file inside the `.ssh` directory, and while it's not strictly required for SSH to work, its absence can sometimes cause SSH or Git clients to behave inconsistently — especially in containerized environments where permissions and file presence can impact behavior more than expected.

You can approach as below steps

1. **Create an empty SSH config file**

Even if you don’t need custom SSH options, try creating an empty config file inside the mounted `.ssh` directory:

```auto
touch /path/to/your/host/.ssh/config
chmod 600 /path/to/your/host/.ssh/config

```

Make sure this is owned by the same user that Node-RED runs as inside the container (likely `node-red` or UID 1000), and that your Docker volume mounts `.ssh` correctly to `/home/node-red/.ssh`.

**Verify known\_hosts persistence**

Sometimes the issue isn’t with the config, but with the host fingerprint verification being lost between container restarts. Check that `known_hosts` is preserved properly:

```auto
ssh-keyscan github.com >> /path/to/your/host/.ssh/known_hosts

```

(Replace `github.com` with your Git server if it's private.)

This ensures the container doesn’t prompt for manual fingerprint confirmation each time it restarts.

**Double-check Docker volume mount**

Ensure you're mounting `.ssh` _before_ the container starts, and to the right path:

```auto
volumes:
  - /your/host/.ssh:/home/node-red/.ssh

```

If `.ssh` doesn’t exist inside the container at that path during startup, Git won’t find your keys or config.

**Run as correct user**

If Node-RED inside the container is running as a different user (not `node-red`), it might not have access to `/home/node-red/.ssh`. You can confirm this by inspecting the user ID inside the container:

```auto
docker exec -it <container> whoami

```

You may need to match the UID of the mounted `.ssh` files accordingly.

* * *

Let us know if this helps or if you'd like to share your Dockerfile or `docker-compose.yml` — happy to take a look and help dig deeper.

Cheers!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [16 September 2025 13:33 UTC](https://discourse.nodered.org/t/config-file-in-ssh-not-been-created-which-is-leading-to-know-hosts-verification-fail/98139/3 "2025-09-16T13:33:32Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
