jenkinsci / jenkinsci/ssh-agent-plugin

[JENKINS-73018] Getting "script returned exit code 128"

Open
#273 1 comment 0 reactions 0 assignees View on GitHub
component:ssh-agent-plugin imported-jira-issue priority:blocker resolution:unresolved
Dominant language
Java
Stars
63
Forks
81
Avg merge
5h 36m
Merged PRs (30d)
9

Description

While calling the git client from within the ssh agent's scope it is giving "script returned exit code 128" error 

stage ('Prune git tags') 

{
steps {
sshagent(['Credential_ID'])
{
sh '''
git tag --list | xargs git tag --delete && git fetch --tags
    '''
}
}
}

Upon adding 

Host *.stie.com  StrictHostKeyChecking no  UserKnownHostsFile /dev/null 

Jenkins builds started passing but for GitHub

Host github.com  StrictHostKeyChecking no  UserKnownHostsFile /dev/null 

it is still failing the build.

 

For me adding a host key entry in every call is difficult. Can I add something like global host key and pass them in sshagent globally, I have already added them for internal SCM Urls for git calls. But somehow they are not being passed under the sshagent scope calls on slave node.

---
Originally reported by ojash97, imported from: Getting "script returned exit code 128"


  • status: Open
  • priority: Blocker
  • component(s): ssh-agent-plugin
  • resolution: Unresolved
  • votes: 0
  • watchers: 1
  • imported: 20260604-211335

Raw content of original issue

While calling the git client from within the ssh agent's scope it is giving "script returned exit code 128" error 



stage ('Prune git tags') 

{
steps {
sshagent(['Credential_ID'])
{
sh '''
git tag --list | xargs git tag --delete && git fetch --tags
    '''
}
}
}


Upon adding 



Host *.stie.com  StrictHostKeyChecking no  UserKnownHostsFile /dev/null 


Jenkins builds started passing but for GitHub



Host github.com  StrictHostKeyChecking no  UserKnownHostsFile /dev/null 


it is still failing the build.

 

For me adding a host key entry in every call is difficult. Can I add something like global host key and pass them in sshagent globally, I have already added them for internal SCM Urls for git calls. But somehow they are not being passed under the sshagent scope calls on slave node.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.