0

Having some issues with repetitive logs inside nodejs container,

this is my flow :
  • Nodejs container fetching ssh key(private key)
  • Loading it into ssh-agent (eval "$(ssh-agent -s)" && cp ${key} ~/.ssh/id_rsa)
  • Cloning a git repository using ssh
  • Running git pull intervals every 1m

Error :

Getting "Warning: Permanently added 'github.com,140.82.x.x' (ECDSA) to the list of known hosts" on each git pull command

What I tried so far :
  • Remove stdout from node execSync command
  • add this to ~/.ssh/config and restarting ssh-agent with eval:
Host *
  StrictHostKeyChecking no
  UserKnownHostsFile ~/.ssh/known_hosts
  LogLevel ERROR
  IdentityFile ~/.ssh/id_rsa
Eyal Solomon
  • 125
  • 1
  • 7

1 Answers1

1

Try to use below parameters, but remember in case of issue you might not get any details in such case you need to change log level again.

Host *
  StrictHostKeyChecking no
  UserKnownHostsFile /dev/null
  LogLevel quiet
asktyagi
  • 2,860
  • 2
  • 8
  • 25
  • will try this out.should I test it under `Host *` ? and also does restarting the ssh-agent will be enough to see changes – Eyal Solomon Aug 24 '22 at 14:19
  • `Host *` personally not recommended, please use with specific host ip/name. No need to restart anything. – asktyagi Aug 24 '22 at 14:21
  • will try one last clarification question - should `Host github` should be ok ? as it happens only with that host – Eyal Solomon Aug 24 '22 at 14:23
  • Though you can get lots of example, but i am using `Host github.com`, again it's based on your use case/configs etc. – asktyagi Aug 24 '22 at 14:30
  • quick update, tried changing the `~/.ssh/config` like you suggested -> still seeing same warnings .. – Eyal Solomon Aug 25 '22 at 07:39
  • and on which level should I have this `config` file ? inside the container on at the host level – Eyal Solomon Aug 25 '22 at 07:47
  • You should try at ssh client host, from where you are doing ssh. Please share ssh config section you tried. – asktyagi Aug 25 '22 at 07:54
  • tried `Host github.com UserKnownHostsFile=/dev/null LogLevel=quiet` with no success – Eyal Solomon Aug 25 '22 at 13:29
  • updated my answer, to check elimination method, can you try it? – asktyagi Aug 25 '22 at 13:34
  • found out that `GIT_SSH_COMMAND` was exported as environment variable within the Dockerfile, with `=ssh -i ~/.ssh/id_rsa -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o LogLevel=ERROR` while getting the warnings, `~/.ssh/id_rsa` is a file created within the container holding the private key for auth to github – Eyal Solomon Aug 25 '22 at 16:53
  • quick update : updating the `GIT_SSH_COMMAND` with your suggested values solved the issue, thanks. – Eyal Solomon Aug 26 '22 at 06:39