From aebe080e859b52d2232b40954b0dc51e4f97e3d8 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Wed, 7 Feb 2018 10:50:32 +0000 Subject: [PATCH] Add support for GIT_SSH on older levels of git --- Gruntfile.js | 4 ++-- red/runtime/storage/localfilesystem/projects/git/index.js | 4 ++++ .../storage/localfilesystem/projects/git/node-red-ssh.sh | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) create mode 100755 red/runtime/storage/localfilesystem/projects/git/node-red-ssh.sh diff --git a/Gruntfile.js b/Gruntfile.js index 0dc1fda525..2be2d23c08 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -392,9 +392,9 @@ module.exports = function(grunt) { mode: '755' }, release: { - // Target-specific file/dir lists and/or options go here. src: [ - path.resolve('<%= paths.dist %>/node-red-<%= pkg.version %>/nodes/core/hardware/nrgpio*') + path.resolve('<%= paths.dist %>/node-red-<%= pkg.version %>/nodes/core/hardware/nrgpio*'), + path.resolve('<%= paths.dist %>/node-red-<%= pkg.version %>/red/runtime/storage/localfilesystem/projects/git/node-red-*sh') ] } }, diff --git a/red/runtime/storage/localfilesystem/projects/git/index.js b/red/runtime/storage/localfilesystem/projects/git/index.js index d36fed22e5..a6f6e32298 100644 --- a/red/runtime/storage/localfilesystem/projects/git/index.js +++ b/red/runtime/storage/localfilesystem/projects/git/index.js @@ -105,6 +105,10 @@ function runGitCommandWithSSHCommand(args,cwd,auth) { commandEnv.NODE_RED_GIT_NODE_PATH = process.execPath; commandEnv.NODE_RED_GIT_SOCK_PATH = rs.path; commandEnv.NODE_RED_GIT_ASKPASS_PATH = path.join(__dirname,"authWriter.js"); + // For git < 2.3.0 + commandEnv.GIT_SSH = path.join(__dirname,"node-red-ssh.sh"); + commandEnv.NODE_RED_KEY_FILE=auth.key_path; + // GIT_SSH_COMMAND - added in git 2.3.0 commandEnv.GIT_SSH_COMMAND = "ssh -i " + auth.key_path + " -F /dev/null"; // console.log('commandEnv:', commandEnv); return runGitCommand(args,cwd,commandEnv).finally(function() { diff --git a/red/runtime/storage/localfilesystem/projects/git/node-red-ssh.sh b/red/runtime/storage/localfilesystem/projects/git/node-red-ssh.sh new file mode 100755 index 0000000000..26a232f830 --- /dev/null +++ b/red/runtime/storage/localfilesystem/projects/git/node-red-ssh.sh @@ -0,0 +1 @@ +ssh -i "$NODE_RED_KEY_FILE" -F /dev/null $@