-
Bug
-
Resolution: Unresolved
-
Minor
-
None
Basically, I am trying to create a credential on jenkins via Rest API. Using xml data below:
```
<?xml version='1.0' encoding='UTF-8'?>
<com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey>
<scope>GLOBAL</scope>
<id>jenkins-github-ssh</id>
<description>jenkins-github-ssh</description>
<username>username</username>
<directEntryPrivateKeySource>
<privateKey>----BEGIN OPENSSH PRIVATE KEY----
*****************************************
----END OPENSSH PRIVATE KEY----</privateKey>
</directEntryPrivateKeySource>
</com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey>
```
I can see the [credential][1] after calling REST post request. But when I use this credential for a GitHub repository, Jenkins says:
>Failed to connect to repository : Command "git ls-remote -h – git@github.com:***.git HEAD" returned status code 128:
stdout:
stderr: Load key "/tmp/ssh3978703187838467164.key": invalid format
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
But If I update the credential which is created by rest api with same private key above manually. It works. Somehow key is broken while posting, which seems to be a bug.
Do you guys have any idea to point me to a workaround?
Jenkins 2.198 & SSH Credentials Plugin 1.17.3
Thanks
- links to
Is that a PKCS#12 private key? If so, that's a known limitation. To work around that, you can convert it to either the old PEM format or to the OpenSSH format.