jenkins failed to connect to remote bit bucket repository

不羁的心 提交于 2019-12-05 13:51:56

问题


I am using jenkins and trying to connect to the bit bucket remote repository for that I provide the bit bucket URL in source code management in git repositories, I create the credentials also for that bit bucket account added in the credentials

I tried the below in git repositories

https://nagarjun123@bitbucket.org/gsmohan/quickride.git

But it gives the error below specified:

ERROR:Failed to connect to repository : Failed to connect to https://nagarjun123@bitbucket.org/gsmohan/quickride.git using credentials bitbucket account (status = 401)

Can anyone please help to me?


回答1:


Change repository address to this format:

https://user:password@bitbucket.org/user/project_name.git

And of course:

  • user - your bitbucket user,
  • password- your bitbucket password,
  • project_name - name of project/repo,



回答2:


In Jenkins ver. 2.6 just use

https://user@bitbucket.org/user/project_name.git 

And add your credentials.

Important: Make sure that your git installed version is greater or equals than 1.7.4 because of the --local issue.

If you are on CentOS maybe you face the same problem than me. Here is a great answer from @AmirHd to upgrade git version on CentOS, if you already have git installed just type:

yum --disablerepo=base,updates --enablerepo=rpmforge-extras update git

Hope this helps!!!




回答3:


I personnaly use that structure :

git@CREDENTIALS:BUCKET_TEAM/BUCKET_REPO.git

Questions : How many credentials do you have ? If you have more than one, you should clearly setup them within your server

Be carefull ! Jenkins when adding SSh keys DOES NOT accept passphrases

check your ssh keys within $HOME/.ssh/config and $HOME/.ssh/know_host of jenkins user (if jenkins is a service) or your application server user

One last point, YOU MUST first login with your jenkins user using SSH before enabling jenkins sync with git with a ssh git@bitbucket.org



来源:https://stackoverflow.com/questions/24155924/jenkins-failed-to-connect-to-remote-bit-bucket-repository

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!