I am trying to create a tag via Jenkinsfile and followed by pushing it to the remote repository copnnected via ssh.
For reference:
Using single pipeline in Jenkins.
I have webhooks setup in bitbucket which triggers a build in Jenkins whenever I push code. Works if I connect via https.
I already have generated ssh keys stored locally. These keys works when I work on the code (pull/push) via my ide.
Using this same ssh key (thus no change for public key in bitbucket), added the private key in Jenkins via Credentials. The store is called Jenkins, Domain is Global. Refer to screen shot on how my credential is setup.
But when I try to set up the repository via ssh, I get the following error:
Failed to connect to repository : Command "git.exe ls-remote -h -- [email protected]:myname/jenproject.git HEAD" returned status code 128: stdout: stderr: Load key "C:\Windows\TEMP\jenkins-gitclient-ssh145544752032398406.key": invalid format [email protected]: Permission denied (publickey). fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
It looks like it is not reading from the right place. Could I get some help on this. Do I need further settings? Been following tutorials and video guides and the suggestion was to set up ssh keys which I have. Please advice. Thanks.