404 error with Jenkins and bitbucket

Alexander Riggs October 16, 2013

When attempting to use the git plugin on jenkins to connect my bitbucket repository, i get the following error:

Failed to connect to repository : Failed to connect to https://<username>@bitbucket.org/<username>/<repo>.git (status = 404)

and of course I just copy and paste the URL into jenkins, so all the information is filled in. I have seen where other people have the same problem, but I cannot seem to ever find a fix or understand what they are saying.

If I use GitHub, it works just fine, so I am 99% sure its not my end...

So has anyone had this error and fixed it?

8 answers

1 accepted

Suggest an answer

Log in or Sign up to answer
2 votes
Answer accepted
Jeff Thomas
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 16, 2013

I ran into a similar issue when trying to connect Jenkins to our Stash repositories over HTTP (https://answers.atlassian.com/questions/221482/jenkins-unable-to-clone-stash-repository).

I ended up using SSH and it worked. If you switch to SSH, does it work?

Alexander Riggs October 16, 2013

I have been trying for the last hour, but I cannot get past this no matter what I do:

stderr: Host key verification failed.

fatal: The remote end hung up unexpectedly

I have tried many different ways to make keys, but I am still learning linux, so I am not really sure what I am doing.

Jeff Thomas
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 16, 2013

You're following this guide for setting up your SSH key on your local machine and Bitbucket, correct?

Are you able to run the git clone command as the Jenkins user? You might be running into an issue where the bitbucket server needs to be added as a known source.

Login as the user that Jenkins is running as and try to clone your repository.

Joshua Davis October 23, 2013

So the workaround is to switch to SSL authentication? That seems like a lot of work for something that is working fine on our other Jenkins installation.

0 votes
Steven Dick February 26, 2014

I have been successfull getting Jenkins to work with Bitbucket via HTTPS.

I'm using Jenkins 1.548 on Windows. When testing with version 2.0 of the Git client I could not get the HTTPS URL with the user and password to work.

I upgraded to the 2.0.3 version of the Git client and it still didn't work.

The final step was to remove the user name and password from the URL and add the user name and password to the creditionals section (which is immediately after the Git URL).

This works.

0 votes
Joshua Davis October 23, 2013

I switched to SSH and it is working now. Looks like there might be a nasty bug in 2.0.

0 votes
José Diaz October 23, 2013

I resolved the issue.

I follow the instructions of https://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin

The tip is copy the .ssh/files to the .ssh of the account system local.

Joe

0 votes
Joshua Davis October 23, 2013

I have the same issue now. Strangely it works from the command line as the Jenkins user (https URL, using .netrc to authenticate). We also have another Jenkins instance where it works fine, but that is using the git-plugin v2.0. Maybe the git plugin is the problem?

0 votes
Jeff Thomas
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 23, 2013

I suspect that it is the git-plugin causing the problem. I'm currently running v1.5 and haven't tried 2.0, so you may be right!

0 votes
José Diaz October 17, 2013

If I for jenkis 1.535 in my build configuration do check

SSH Agent, the error is:

Ejecutado por el programador

Ejecutando.en el espacio de trabajo C:\Jenkins\workspace\leiloes

[ssh-agent] Using credentials JOENET$

[ssh-agent] Looking for ssh-agent implementation...

[ssh-agent] FATAL: Could not find a suitable ssh-agent provider

[ssh-agent] Diagnostic report

FATAL: [ssh-agent] Unable to start agent

If the check is not marked the build never finish.

Jeff Thomas
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 17, 2013

Do you have the SSH Agent plugin installed in Jenkins?

0 votes
José Diaz October 17, 2013

Hello Jeff. I configure my SSH key on my local machine.

I can do git clone without problems.

I associate a deployment key a my repository according to https://confluence.atlassian.com/display/BITBUCKET/Use+deployment+keys;jsessionid=684DCB09826C9A9B9183E6919BD39A38

I downloaded the jenkins today (18 oct 2013).

I installed git plugin.

I created a job with the url

git@bitbucket.org:username/prueba.git

the problem is that the build never finish.

I need some setup additional?

Joe

Jeff Thomas
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 17, 2013

What is the error that you're getting that causes the build to not finish?

TAGS
AUG Leaders

Atlassian Community Events