Configuring a remote repository from bitbucket into Jenkins is quite simple.

Verify you’ve installed the git plugins and everything is up-to-date:

Create a new free-style project

Configure the project

In this step I opted adding my credentials into the URL in the format https://<username>:<password>@bitbucket.org/repo but it’s better to setup SSH credentials if possible. You can obtain the URL from bitbucket, it’s the same one you would use to clone your repository.

And that’s it!

tarted by user anonymous
[EnvInject] - Loading node environment variables.
Building in workspace C:\Program Files (x86)\Jenkins\workspace\getit
 > C:\Program Files\Git\bin\git.exe rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
 > C:\Program Files\Git\bin\git.exe config remote.origin.url https://migueleonardortiz:*******@bitbucket.org/myrepo/my-repo-uri.git # timeout=10
Fetching upstream changes from https://migueleonardortiz@bitbucket.org/myrepo/my-repo-uri.git
 > C:\Program Files\Git\bin\git.exe --version # timeout=10
 > C:\Program Files\Git\bin\git.exe fetch --tags --progress https://migueleonardortiz@bitbucket.org/myrepo/my-repo-uri.git +refs/heads/*:refs/remotes/origin/*
 > C:\Program Files\Git\bin\git.exe rev-parse "refs/remotes/origin/master^{commit}" # timeout=10
 > C:\Program Files\Git\bin\git.exe rev-parse "refs/remotes/origin/origin/master^{commit}" # timeout=10
Checking out Revision 3972e0b619b24a1ff0387496ac03711a66c6b153 (refs/remotes/origin/master)
Commit message: "agrego instrucciones de uso"
 > C:\Program Files\Git\bin\git.exe config core.sparsecheckout # timeout=10
 > C:\Program Files\Git\bin\git.exe checkout -f 3972e0b619b24a1ff0387496ac03711a66c6b153
First time build. Skipping changelog.
Finished: SUCCESS

If you receive the message: ERROR: Error fetching remote repo ‘origin’ verify your credentials.