Issues with Git plugin and Bitbucket

1,010 views
Skip to first unread message

Daniel Guisinger

unread,
Aug 13, 2016, 3:54:12 PM8/13/16
to Jenkins Users
Hey guys, I am hitting my head against the wall with what should be an extremely easy thing to get working....

I'm trying to use the git scm interface in jenkins to pull down a test project off bitbucket.
I keep getting authentication errors.

I have setup my username/password in the credential manager.

Here are the things I've tried:
http://user...@bitbucket.org.....    fails
http://username:pass...@bitbucket.org...... fails
http//username:pass...@bitbucket.org..., with no -none- selected for credentials.... fails

http://bitbucket.org.... but with the repository made public.... success
http://username:pass...@bitbucket.org.... but with the repository made public.... success

From the command line, I can perform a git clone command with the username:password syntax with no issues.

I am at a complete loss as to why I can't get the git plug-in to authenticate.
I'm hoping someone else has experience with this issue because I'm just spinning my wheels and am making no progress....

Mark Waite

unread,
Aug 13, 2016, 5:23:50 PM8/13/16
to Jenkins Users
I assume you're using https rather than http protocol for the URL.  If not, then that is worth trying.

Is there a reason you're not using the URL https://bitbucket.org/username/reponame (like https://bitbucket.org/markewaite/git-client-plugin or https://bitbucket.org/markewaite/bin) and then placing your username and password into a credential which you can then choose from the credentials drop down list?  That's the technique I use for the git client plugin unit tests with bitbucket, for the integration tests with bitbucket, and for the acceptance tests with bitbucket.

You could also consider switching from https protocol to ssh protocol.  If you choose to use ssh protocol, then you'll need to add a public key to your bitbucket account, register the private key with the Jenkins credential manager, then reference that private key from your job definition.

Thanks,
Mark Waite

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/59ff9e75-466c-4a33-8bd7-25da22c6044a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Daniel Guisinger

unread,
Aug 13, 2016, 6:50:13 PM8/13/16
to Jenkins Users
Sorry Mark, thats exactly what i was doing.
Like I said, it works the instant I mark the repository public, and the credentials drop down isn't working, I select the credentials but it still fails to authenticate.  It even gives me a red error message in the UI  (See attached screenshot)

I didn't put the full URL because its a private repository and as I mentioned, as soon as I mark it public it works, so the is correct...

Dan


On Saturday, August 13, 2016 at 4:23:50 PM UTC-5, Mark Waite wrote:
I assume you're using https rather than http protocol for the URL.  If not, then that is worth trying.

Is there a reason you're not using the URL https://bitbucket.org/username/reponame (like https://bitbucket.org/markewaite/git-client-plugin or https://bitbucket.org/markewaite/bin) and then placing your username and password into a credential which you can then choose from the credentials drop down list?  That's the technique I use for the git client plugin unit tests with bitbucket, for the integration tests with bitbucket, and for the acceptance tests with bitbucket.

You could also consider switching from https protocol to ssh protocol.  If you choose to use ssh protocol, then you'll need to add a public key to your bitbucket account, register the private key with the Jenkins credential manager, then reference that private key from your job definition.

Thanks,
Mark Waite

On Sat, Aug 13, 2016 at 1:54 PM Daniel Guisinger <dguis...@gmail.com> wrote:
Hey guys, I am hitting my head against the wall with what should be an extremely easy thing to get working....

I'm trying to use the git scm interface in jenkins to pull down a test project off bitbucket.
I keep getting authentication errors.

I have setup my username/password in the credential manager.

Here are the things I've tried:
http://username:password@bitbucket.org...... fails
http//username:password@bitbucket.org..., with no -none- selected for credentials.... fails

http://bitbucket.org.... but with the repository made public.... success
http://username:password@bitbucket.org.... but with the repository made public.... success

From the command line, I can perform a git clone command with the username:password syntax with no issues.

I am at a complete loss as to why I can't get the git plug-in to authenticate.
I'm hoping someone else has experience with this issue because I'm just spinning my wheels and am making no progress....
Screen Shot 2016-08-13 at 5.48.09 PM.png

Mark Waite

unread,
Aug 13, 2016, 6:54:36 PM8/13/16
to Jenkins Users
I recently had to switch my bitbucket credentials from using the "username" based credential (markewaite) to the e-mail based credential because I was upgraded from one form of authorization to a different form.  Have you tried using your e-mail address and password in the credential instead of your user name and password?

Mark Waite

On Sat, Aug 13, 2016 at 4:50 PM Daniel Guisinger <dguis...@gmail.com> wrote:
Sorry Mark, thats exactly what i was doing.
Like I said, it works the instant I mark the repository public, and the credentials drop down isn't working, I select the credentials but it still fails to authenticate.  It even gives me a red error message in the UI  (See attached screenshot)

I didn't put the full URL because its a private repository and as I mentioned, as soon as I mark it public it works, so the is correct...

Dan


On Saturday, August 13, 2016 at 4:23:50 PM UTC-5, Mark Waite wrote:
I assume you're using https rather than http protocol for the URL.  If not, then that is worth trying.

Is there a reason you're not using the URL https://bitbucket.org/username/reponame (like https://bitbucket.org/markewaite/git-client-plugin or https://bitbucket.org/markewaite/bin) and then placing your username and password into a credential which you can then choose from the credentials drop down list?  That's the technique I use for the git client plugin unit tests with bitbucket, for the integration tests with bitbucket, and for the acceptance tests with bitbucket.

You could also consider switching from https protocol to ssh protocol.  If you choose to use ssh protocol, then you'll need to add a public key to your bitbucket account, register the private key with the Jenkins credential manager, then reference that private key from your job definition.

Thanks,
Mark Waite

On Sat, Aug 13, 2016 at 1:54 PM Daniel Guisinger <dguis...@gmail.com> wrote:
Hey guys, I am hitting my head against the wall with what should be an extremely easy thing to get working....

I'm trying to use the git scm interface in jenkins to pull down a test project off bitbucket.
I keep getting authentication errors.

I have setup my username/password in the credential manager.

Here are the things I've tried:
http://username:pass...@bitbucket.org...... fails
http//username:pass...@bitbucket.org..., with no -none- selected for credentials.... fails

http://bitbucket.org.... but with the repository made public.... success
http://username:pass...@bitbucket.org.... but with the repository made public.... success

From the command line, I can perform a git clone command with the username:password syntax with no issues.

I am at a complete loss as to why I can't get the git plug-in to authenticate.
I'm hoping someone else has experience with this issue because I'm just spinning my wheels and am making no progress....

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.

Daniel Guisinger

unread,
Aug 13, 2016, 7:22:44 PM8/13/16
to Jenkins Users
Just tried that, it didn't work either :(

Started by user Dan Guisinger
Building in workspace /var/lib/jenkins/workspace/test
 > git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
 > git config remote.origin.url https://bitbucket.org/xxxxxxxx/test.git # timeout=10
Fetching upstream changes from https://bitbucket.org/xxxxxxx/test.git
 > git --version # timeout=10
using .gitcredentials to set credentials
 > git config --local credential.username xxxxxxxx@xxxxxxxx # timeout=10
 > git config --local credential.helper store --file=/tmp/git8249520542225893250.credentials # timeout=10
 > git -c core.askpass=true fetch --tags --progress https://bitbucket.org/xxxxxxxx/test.git +refs/heads/*:refs/remotes/origin/*
 > git config --local --remove-section credential # timeout=10
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from https://bitbucket.org/xxxxxxxx/test.git
	at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:799)
	at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1055)
	at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1086)
	at hudson.scm.SCM.checkout(SCM.java:495)
	at hudson.model.AbstractProject.checkout(AbstractProject.java:1278)
	at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:604)
	at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529)
	at hudson.model.Run.execute(Run.java:1720)
	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
	at hudson.model.ResourceController.execute(ResourceController.java:98)
	at hudson.model.Executor.run(Executor.java:404)
Caused by: hudson.plugins.git.GitException: Command "git -c core.askpass=true fetch --tags --progress https://bitbucket.org/xxxxxx/test.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout: 
stderr: remote: Invalid username or password. If you log in via a third party service you must ensure you have an account password set in your account profile.
fatal: Authentication failed for 'https://bitbucket.org/xxxxxx/test.git/'

	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1723)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1459)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:63)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:314)
	at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:797)
	... 11 more
ERROR: null
Finished: FAILURE

Mark Waite

unread,
Aug 13, 2016, 7:30:53 PM8/13/16
to Jenkins Users
Unfortunately, you've exhausted my guesses.  You might try ssh protocol instead of https?

Mark Waite

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.

Daniel Guisinger

unread,
Aug 13, 2016, 7:56:46 PM8/13/16
to Jenkins Users
Just tried ssh and it works (YAY)...  Thanks for the help

arggg, I hate not knowing why something simple doesn't work...

dhiraj.p...@games24x7.com

unread,
Jun 19, 2018, 4:11:48 AM6/19/18
to Jenkins Users
Hi Daniel, when you say it worked with ssh, what exactly did you do?

Mark Waite

unread,
Jun 19, 2018, 6:56:37 AM6/19/18
to jenkins...@googlegroups.com
He switched from cloning within the https protocol to use ssh protocol instead. 


Mark Waite

Reply all
Reply to author
Forward
0 new messages