MCPcopy Create free account
hub / github.com/easingthemes/ssh-deploy / updateKnownHosts

Function updateKnownHosts

src/sshKey.js:27–38  ·  view source on GitHub ↗
(host, remotePort)

Source from the content-addressed store, hash-verified

25};
26
27const updateKnownHosts = (host, remotePort) => {
28 const { knownHostsPath } = getPrivateKeyPath();
29 console.log('[SSH] Adding host to `known_hosts` ....', host, knownHostsPath);
30 try {
31 execSync(`ssh-keyscan -p ${(remotePort || 22)} -H ${host} >> ${knownHostsPath}`, {
32 stdio: 'inherit'
33 });
34 } catch (error) {
35 console.error('❌ [SSH] Adding host to `known_hosts` ERROR', host, error.message);
36 }
37 console.log('✅ [SSH] Adding host to `known_hosts` DONE', host, knownHostsPath);
38};
39
40module.exports = {
41 getPrivateKeyPath,

Callers 1

runFunction · 0.85

Calls 1

getPrivateKeyPathFunction · 0.85

Tested by

no test coverage detected