From 25b4da1ab7ef498985c74be4556caf8e4861f11e Mon Sep 17 00:00:00 2001 From: kdletters Date: Tue, 1 Sep 2026 12:09:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B6=88=E9=99=A4AGC=E6=B5=81=E6=B0=B4?= =?UTF-8?q?=E7=BA=BF=E5=AF=86=E9=92=A5=E6=8F=92=E5=80=BC=E8=AD=A6=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在Windows PowerShell内设置临时Git SSH命令 --- jenkins/Jenkinsfile.ai-game-creator-shell-build | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/jenkins/Jenkinsfile.ai-game-creator-shell-build b/jenkins/Jenkinsfile.ai-game-creator-shell-build index e8cdb7096..c2e74bcfd 100644 --- a/jenkins/Jenkinsfile.ai-game-creator-shell-build +++ b/jenkins/Jenkinsfile.ai-game-creator-shell-build @@ -29,9 +29,9 @@ pipeline { stage('Checkout') { steps { withCredentials([sshUserPrivateKey(credentialsId: env.GIT_REMOTE_CREDENTIAL_ID, keyFileVariable: 'GIT_SSH_KEY', usernameVariable: 'GIT_SSH_USER')]) { - withEnv(["GIT_SSH_COMMAND=ssh -i \"${env.GIT_SSH_KEY}\" -o StrictHostKeyChecking=no"]) { - powershell ''' + powershell ''' $ErrorActionPreference = 'Stop' + $env:GIT_SSH_COMMAND = "ssh -i `"$env:GIT_SSH_KEY`" -o StrictHostKeyChecking=no" $git = 'C:\\Tools\\Git\\cmd\\git.exe' if (-not (Test-Path $git)) { throw "找不到 Git: $git" } if (Test-Path '.git') { @@ -65,8 +65,7 @@ pipeline { $resolved = (& $git rev-parse HEAD).Trim() Set-Content -Path '.jenkins-source-commit' -Value $resolved -NoNewline Write-Host "源码 commit=$resolved" - ''' - } + ''' } } }