diff --git a/.rebase/replace/code/extensions/git/src/ssh-askpass.sh.json b/.rebase/replace/code/extensions/git/src/ssh-askpass.sh.json new file mode 100644 index 00000000000..7e89281ce7d --- /dev/null +++ b/.rebase/replace/code/extensions/git/src/ssh-askpass.sh.json @@ -0,0 +1,6 @@ +[ + { + "from": "#!/bin/sh", + "by": "#!/bin/sh\\\nif [ -f /etc/ssh/passphrase ] && command -v ssh-keygen >/dev/null; then\\\n\\\tif ssh-keygen -y -P \"$(cat /etc/ssh/passphrase)\" -f /etc/ssh/dwo_ssh_key >/dev/null; then\\\n\\\t\\\tcat /etc/ssh/passphrase\\\n\\\t\\\texit 0\\\n\\\tfi\\\nfi" + } +] diff --git a/code/extensions/git/src/ssh-askpass.sh b/code/extensions/git/src/ssh-askpass.sh index 1ce0b8df61d..8461e02c02b 100755 --- a/code/extensions/git/src/ssh-askpass.sh +++ b/code/extensions/git/src/ssh-askpass.sh @@ -1,3 +1,11 @@ #!/bin/sh -# see https://github.com/devfile/devworkspace-operator/blob/main/docs/additional-configuration.adoc#configuring-devworkspaces-to-use-ssh-keys-for-git-operations -cat /etc/ssh/passphrase +if [ -f /etc/ssh/passphrase ] && command -v ssh-keygen >/dev/null; then + if ssh-keygen -y -P "$(cat /etc/ssh/passphrase)" -f /etc/ssh/dwo_ssh_key >/dev/null; then + cat /etc/ssh/passphrase + exit 0 + fi +fi +VSCODE_GIT_ASKPASS_PIPE=`mktemp` +ELECTRON_RUN_AS_NODE="1" VSCODE_GIT_ASKPASS_PIPE="$VSCODE_GIT_ASKPASS_PIPE" VSCODE_GIT_ASKPASS_TYPE="ssh" "$VSCODE_GIT_ASKPASS_NODE" "$VSCODE_GIT_ASKPASS_MAIN" $VSCODE_GIT_ASKPASS_EXTRA_ARGS $* +cat $VSCODE_GIT_ASKPASS_PIPE +rm $VSCODE_GIT_ASKPASS_PIPE diff --git a/rebase.sh b/rebase.sh index ead2d317778..08154561fcb 100755 --- a/rebase.sh +++ b/rebase.sh @@ -316,8 +316,11 @@ apply_code_src_vs_code_browser_workbench_workbench_changes() { apply_code_extensions_git_src_ssh-askpass_changes() { echo " ⚙️ reworking code/extensions/git/src/ssh-askpass.sh..." - # reset the file from local - git checkout --ours code/extensions/git/src/ssh-askpass.sh > /dev/null 2>&1 + # reset the file from upstream + git checkout --theirs code/extensions/git/src/ssh-askpass.sh > /dev/null 2>&1 + + # apply the changes + apply_replace code/extensions/git/src/ssh-askpass.sh # resolve the change git add code/extensions/git/src/ssh-askpass.sh > /dev/null 2>&1