| 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 – g...@github.com:***.git HEAD" returned status code 128: stdout: stderr: Load key "/tmp/ssh3978703187838467164.key": invalid format g...@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 [1]: https://i.stack.imgur.com/j7Ncg.png |