Merge pull request #156 from mansandersson/fix-key-line-endings
Normalize line endings in SSH key for the underlying OS
This commit is contained in:
commit
448aa45aa1
2
dist/index.js
vendored
2
dist/index.js
vendored
File diff suppressed because one or more lines are too long
@ -1,5 +1,6 @@
|
|||||||
const { join } = require('path');
|
const { join } = require('path');
|
||||||
const { execSync } = require('child_process');
|
const { execSync } = require('child_process');
|
||||||
|
const { EOL } = require('os');
|
||||||
const { writeToFile } = require('./helpers');
|
const { writeToFile } = require('./helpers');
|
||||||
|
|
||||||
const KNOWN_HOSTS = 'known_hosts';
|
const KNOWN_HOSTS = 'known_hosts';
|
||||||
@ -19,7 +20,7 @@ const addSshKey = (content, deployKeyName) => {
|
|||||||
const { dir, filename } = getPrivateKeyPath(deployKeyName);
|
const { dir, filename } = getPrivateKeyPath(deployKeyName);
|
||||||
writeToFile({ dir, filename: KNOWN_HOSTS, content: '' });
|
writeToFile({ dir, filename: KNOWN_HOSTS, content: '' });
|
||||||
console.log('✅ [SSH] known_hosts file ensured', dir);
|
console.log('✅ [SSH] known_hosts file ensured', dir);
|
||||||
writeToFile({ dir, filename, content: `${content}\r\n`, isRequired: true, mode: '0400' });
|
writeToFile({ dir, filename, content: `${content}${EOL}`, isRequired: true, mode: '0400' });
|
||||||
console.log('✅ [SSH] key added to `.ssh` dir ', dir, filename);
|
console.log('✅ [SSH] key added to `.ssh` dir ', dir, filename);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user