I added a new SSH key pair as PRIVATE and PUBLIC key in Jenkinscredentials , now when I run the build they fail with this error>… To see my Jenkinsfile, Please refer to this:
What error? The same one as before? Why did you create a new topic instead of replying to the old?
Thanks for replying, I will replace the heading.The reason to create a new question is because i think this has nothing to do with fetching the origin repo
Earlier, I didnt add ‘PUBLIC_KEY’ to jenkins , which I added later as a new credential with the “kind : Github App” . Although I am not sure ,why do i have to add it again to the credentials here when I have already added it to “settings/keys” of my github account.
The error is mentioned in the screenshot attached: which happens to be either a GIT_ASKPASS error(not sure how that works) and an Illegal Argument exception
The git plugin supports two protocols (ssh and https/http) for accessing a remote repository and one credential type for each protocol that it supports.
For the ssh protocol, with URL’s of the format git@github.com:MarkEWaite/bin.git
or of the format ssh://github.com/MarkEWaite/bin.git
, the plugin supports the “SSH username with private key” credential type. It does not support other credential types for the ssh protocol. The Pipeline snippet syntax generator will not offer other credential types when creating a checkout scm
snippet.
For the https/http protocol, with URLs of the format https://github.com/MarkEWaite/bin.git
, the plugin supports “Username with password” credentials. It does not support other credential types for the http/https protocol. The Pipeline snippet syntax generator will not offer other credential types when creating a checkout scm
snippet.
The message “Using GIT_ASKPASS to set credentials” indicates that the git plugin believes the repository is being accessed with the https/http protocol. That is surprising, since earlier in your log listing it shows a URL that is using SSH protocol.
I’ve never tested the git plugin with a GitHub App password. If it works, I’m glad to hear it, though GitHub App passwords only work with HTTPS protocol, not with SSH protocol.
You need to use an “SSH username with private key” credential to access a GitHub repository with ssh protocol.
Did you generate that with the Pipeline snippet syntax generator? If so, then that indicates there is probably a bug in the git plugin that it is offering credential suggestions that are invalid.