fix(linux): correct PS escape for $GIT_CLONE_URL in UseGitClone clone cmd

In PS double-quoted strings, backslash does NOT escape '$'.
Only backtick does ('`$'). The previous '\' was being
expanded as a PS variable (undefined), triggering StrictMode error:
'Cannot retrieve variable \ because it has not been set.'

Replace '\$' with '`$' so the literal shell variable reference
\ is emitted correctly to the SSH command.
This commit is contained in:
Simone
2026-05-11 18:40:19 +02:00
parent 54399a2120
commit db1530cf0f
+1 -1
View File
@@ -225,7 +225,7 @@ if ($GuestOS -eq 'Linux') {
# PAT injected via env var inside SSH session — never in args
$envCloneCmd = "export GIT_CLONE_URL='$cloneTargetUrl'; git clone --depth 1 --branch '$CloneBranch'"
if ($CloneSubmodules) { $envCloneCmd += ' --recurse-submodules' }
$envCloneCmd += " `"`\$GIT_CLONE_URL`" '$GuestLinuxWorkDir'; unset GIT_CLONE_URL"
$envCloneCmd += " `"`$GIT_CLONE_URL`" '$GuestLinuxWorkDir'; unset GIT_CLONE_URL"
Invoke-SshCommand -IP $IPAddress -User $SshUser -KeyPath $SshKeyPath -Command $envCloneCmd
} else {
Invoke-SshCommand -IP $IPAddress -User $SshUser -KeyPath $SshKeyPath -Command $cloneCmd