You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Jenkins Publish over SSH插件无法复制构建归档求助

Hey there, sorry to hear you’ve spent hours troubleshooting this Jenkins SSH file transfer issue—let’s walk through the most common fixes to get your archive copied over successfully.

1. Double-Check Your Archive & Source File Paths

First, confirm the build task that generates your archive is actually producing the file where you expect it:

  • Go to your build job’s workspace (you can find the path in the job’s Workspace tab) and verify the archive file exists.
  • In the Publish over SSH configuration of your deploy job, make sure the Source files path matches exactly where the archive lives relative to the Jenkins workspace. For example, if your archive is at target/my-app.zip, don’t write just my-app.zip—use target/my-app.zip (or **/my-app.zip if you want to match recursively).
  • Also, ensure you haven’t accidentally checked the Exclude box next to the source path, which would skip copying the file entirely.

2. Validate SSH Server Connection & Remote Directory

If the path checks out, the issue is likely with the remote server setup:

  • Head to Manage Jenkins > Configure System > Publish over SSH, find your remote server entry, and click Test Configuration. If this fails, fix the connection first—common issues include incorrect SSH key, wrong port (default is 22), or the remote server’s firewall blocking Jenkins’ IP.
  • Verify the Remote directory is correct: this path is relative to the SSH user’s home directory. For example, if your SSH user is deploy with home /home/deploy, setting Remote directory to app-builds will target /home/deploy/app-builds. Make sure this directory exists on the remote server, and the SSH user has write permissions:
    mkdir -p /home/deploy/app-builds && chown deploy:deploy /home/deploy/app-builds
    
  • If you’ve added an Exec command after file transfer, temporarily remove it—sometimes a failing post-transfer command can mask that the file copy never happened.

3. Enable Verbose Logging to See Exact Errors

The default Jenkins log for Publish over SSH is way too vague. Let’s turn on debug logging to get concrete details:

  • Go to Manage Jenkins > System Log > Add new log recorder
  • Name it something like SSH Publish Debug, then add the logger jenkins.plugins.publish_over_ssh and set its level to ALL
  • Rerun your deploy job—you’ll now see detailed logs about what the plugin is doing: whether it’s finding the source file, connecting to the remote server, encountering permission errors, etc. This will almost certainly point you to the root cause.

4. Check Jenkins Agent Permissions (If Using Agents)

If your build runs on a Jenkins agent (not the master node):

  • Confirm the agent’s workspace has the archive file, and the agent’s OS user has read access to it.
  • Ensure the agent can reach the remote SSH server (test SSH connectivity from the agent machine manually to rule out network issues).
  • Double-check that the Publish over SSH plugin is configured to run on the correct node (some jobs are tied to specific agents, and the plugin needs access to the archive on that node).

5. Try Switching Transfer Modes

Publish over SSH supports two transfer modes: SCP and SFTP. Sometimes server configurations block one of these protocols. Head to your remote server’s configuration in the plugin settings, switch the Transfer mode option, and re-run the job to see if it works.

内容的提问来源于stack exchange,提问作者Radu

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.21 08:37:57