Git 在新创建的容器中克隆 - known_hosts 有问题

Git clone inside of newly created container - problem with known_hosts

请问如何解决在容器中尝试git clone ... 时由于服务器不在known_hosts中而失败的问题。有没有办法强制“是”:

The authenticity of host '192.168.0.136 (192.168.0.136)' can't be established.
ECDSA key fingerprint is SHA256:tZiiWJJYFdtTmjjk3kunA4dU3wI2WXPI/1O0EsMtIjk.
Are you sure you want to continue connecting (yes/no/[fingerprint])?

我已经试过了yes | git clone ...但是没用

现在我是这样做的:

echo "github.com,140.82.121.3 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==" >> /root/.ssh/known_hosts \

但是第一种方法看起来比在 Dockerfile 中使用这个更好

您可以通过以下方式完成

ssh-keyscan github.com >> /root/.ssh/known_hosts