Jenkins, bit bucket and Vagrant : cannot log in git

I want to integrate Jenkins to my Symfony 2 project, which is on a BitBucket repository.

I installed Jenkins on my Vagrant virtual machine, and then I configure a job.

So, in Source Code Management, I selected Git, and set the BitBucket SSH url in "Repository URL" ( Then, logged as jenkins in my Vagrant box, I generated a SSH key, and I copied the in a new SSH Public Key in BitBucket. I added this key as credidential in my Jenkins job git configuration (with username as my BitBucket username).

Jenkins displays me this error when I try to build the project:

Started by user anonymous
Building in workspace /var/lib/jenkins/jobs/api/workspace
Fetching changes from the remote Git repository
Fetching upstream changes from
using GIT_SSH to set credentials 
FATAL: Failed to fetch from
hudson.plugins.git.GitException: Failed to fetch from
    at hudson.plugins.git.GitSCM.fetchFrom(
    at hudson.plugins.git.GitSCM.retrieveChanges(
    at hudson.plugins.git.GitSCM.checkout(
    at hudson.model.AbstractProject.checkout(
    at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(
    at jenkins.scm.SCMCheckoutStrategy.checkout(
    at hudson.model.AbstractBuild$
    at hudson.model.Run.execute(
    at hudson.model.ResourceController.execute(
Caused by: hudson.plugins.git.GitException: Command "git fetch --tags --progress +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stderr: Permission denied (publickey).
fatal: The remote end hung up unexpectedly

Do you have any idea of what is happening ? Thx !


Its because the remote server denied your pubic key. The logs are telling you that => stderr: Permission denied (publickey).

Do this, head to ~/.ssh Create a file called config and add the following, ensure the values reflect your personal setup.

    User myuser
    IdentityFile /home/myuser/.ssh/id_rsa

Then re-run.

Need Your Help

How to resolve content presenter not displaying View?

wpf mvvm datatemplate tabcontrol contentpresenter

I've added a content presenter to my TabControl's data template, in order to display the correct view.

URL Rewriting: "index.php?id=5" to "home.html"

php url-rewriting

I'm developping a website using php and the "" class.