0

I created a job in jenkins where it pulls the source code from a private repo in bitbucket using ssh keys. So I had to set it up using PUTTY and set an environment variable GIT_SSH to the plink location. So when I pull from the command line, it works fine. Now when I add the bitbucket Repository URL with the credentials, where I added the private key, before I even click on save, it shows an error message

Failed to connect to repository : Command "C:\Program Files\Git\bin\git.exe ls-remote -h repo link. return status code 128. tdout: stderr: Load key "C:\\Windows\\TEMP\\ssh2792596192881196946.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. 

I am not sure why it's giving this message. So I thought of trying it another way where I created a batch file that pulls my repo. From command line, it works fine, but when I add the batch file to Jenkins job, it gives an error:

[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. 

I thought since it works on the command line, if I just add the location of the batch file to jenkins and let it execute it, it should work, but it doesnt.

1 Answer 1

1

Figured it out, had to go to systemInfo on Jenkins, and check if the ssh keys were they for the home location. Found it, it wasn't there, it was pointing to a different location so add the two keys on the jenkins home location and it works now.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.