I'm trying to setup new jenkins project on local machine, I have added bitbucket repo in Source Code Management
section under Git Repositories
But I get an error:
Failed to connect to repository : Command "git ls-remote -h ssh://git@<main_link>/<name1>/<name2>.git HEAD" returned status code 128:
stdout:
stderr: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Howewer I can run this command from my console (also I can do git clone
etc.)
I tried to add ssh key via Add Credentials
with option Private Key - Enter directly
As I understand my private key is under ~/.ssh/
ls ~/.ssh/
cat ~/.ssh/id_dsa
but after I have entered private ssh key from ~/.ssh/id_dsa
nothing changed, I still get the error.
Update: Tried this answer: https://stackoverflow.com/a/15314910/1179925
sudo -i -u jenkins
jenkins@user-VirtualBox:~$ git clone ssh://git@<link>/<name1>/<name2>.git
Cloning into '<name2>'...
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.