1
votes

I have a project on bitbucket with git repository.

I want Jenkins job that pulls stuff from that repository. So I installed the Git Plugin.

I configure My Jenkins job to use git repository. I add credentials I use on BitBucket. Then I enter repository URL like this:

https://[email protected]/PawelRoman/myproject.git

I'm getting the following error in red:

Failed to connect to repository : Failed to connect to https://[email protected]/PawelRoman/myproject.git using credentials PawelRoman on BitBucket (status = 401)

401 seems like an authorization issue, but what can possibly be wrong? When I run git clone command manually from the server where I have Jenkins installed, using exactly the same repo URL and exactly the same credentials - it works without any issue. I am 100% sure the credentials are OK and repository URL is fine. How can I track down the cause of the issue?

2

2 Answers

0
votes

Found out what the issue was. Repository URL was incorrect. For some reason jenkins git plugin does not allow for Username@ in the repository URL.

So instead of https://[email protected]/PawelRoman/myproject.git

You need to use

https://bitbucket.org/PawelRoman/myproject.git

And it will work.

0
votes

User this url to get the project from the bitbucket

https://<user>:<pass>@bitbucket.org/<user>/<project>.git