Skip to content

Commit 85ed9d5

Browse files
Add Support for Using Custom SSH Key (#89)
1 parent 9f6935c commit 85ed9d5

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lib/deployer.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ module.exports = function(args) {
1919
help += ' delete: [true|false] # Default is true\n';
2020
help += ' args: <rsync args>\n';
2121
help += ' rsh: <remote shell>\n';
22+
help += ' key: <key>\n';
2223
help += ' verbose: [true|false] # Default is true\n';
2324
help += ' ignore_errors: [true|false] # Default is false\n\n';
2425
help += 'For more help, you can check the docs: ' + color.underline('https://hexo.io/docs/deployment.html');
@@ -40,7 +41,13 @@ module.exports = function(args) {
4041
if (args.port && args.port > 0 && args.port < 65536) {
4142
params.splice(params.length - 2, 0, '-e');
4243
if (args.rsh) {
43-
params.splice(params.length - 2, 0, `'${args.rsh}' -p ${args.port}`);
44+
if (args.key) {
45+
params.splice(params.length - 2, 0, `'${args.rsh}' -i ${args.key} -p ${args.port}`);
46+
} else {
47+
params.splice(params.length - 2, 0, `'${args.rsh}' -p ${args.port}`);
48+
}
49+
} else if (args.key) {
50+
params.splice(params.length - 2, 0, 'ssh -i ' + args.key + ' -p ' + args.port);
4451
} else {
4552
params.splice(params.length - 2, 0, 'ssh -p ' + args.port);
4653
}

0 commit comments

Comments
 (0)