【问题标题】:Jenkins Unable to connect to Bitbucket cloudJenkins 无法连接到 Bitbucket 云
【发布时间】:2022-04-21 17:33:21
【问题描述】:

我正在 Jenkins 中设置项目,我必须从 bitbucket 云中提取代码。

我在 Jenkins 中看到了错误。问题是 Jenkins 无法连接到 bitbucket 云。

环境
詹金斯:内部托管; http://jenkinsserver:8080
比特桶云:https://bitbucket.org/
Git插件版本:3.5.1

来自 Jenkins 的日志

Started by user admin
[EnvInject] - Loading node environment variables.
Building in workspace /var/lib/jenkins/workspace/AccessbitbucketCloud
 > /opt/git/git-2.14.1/git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
 > /opt/git/git-2.14.1/git config remote.origin.url https://bitbucket.org/myid/testpublicrepo.git # timeout=10
Fetching upstream changes from https://bitbucket.org/myid/testpublicrepo.git
 > /opt/git/git-2.14.1/git --version # timeout=10
using GIT_ASKPASS to set credentials For bitbucket Cloud
Setting http proxy: jenkinsserver:8080
 > /opt/git/git-2.14.1/git fetch --tags --progress https://bitbucket.org/myid/testpublicrepo.git +refs/heads/*:refs/remotes/origin/*
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from https://bitbucket.org/myid/testpublicrepo.git
    at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:817)
    at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1084)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1115)
    at hudson.scm.SCM.checkout(SCM.java:495)
    at hudson.model.AbstractProject.checkout(AbstractProject.java:1276)
    at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:560)
    at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:485)
    at hudson.model.Run.execute(Run.java:1735)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:97)
    at hudson.model.Executor.run(Executor.java:405)
Caused by: hudson.plugins.git.GitException: Command "/opt/git/git-2.14.1/git fetch --tags --progress https://bitbucket.org/myid/testpublicrepo.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout: 
stderr: fatal: unable to access 'https://bitbucket.org/myid/testpublicrepo.git/': Received HTTP code 407 from proxy after CONNECT

    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1924)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1643)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:71)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:352)
    at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:815)
    ... 11 more
ERROR: Error fetching remote repo 'origin'
Finished: FAILURE

【问题讨论】:

    标签: git jenkins bitbucket jenkins-plugins


    【解决方案1】:

    您似乎正在使用代理连接到 Bitbucket 云。您是否尝试过在 jenkins 服务器上对此存储库进行 git 克隆(使用命令行 shell)?

    stderr: 致命:无法访问 'https://bitbucket.org/myid/testpublicrepo.git/':CONNECT 后从代理收到 HTTP 代码 407

    代理似乎无法连接到 bitbucket 云。 HTTP 407 是代理身份验证错误。 This 是一个关于 git connection over proxy for jenkins 的好帖子。

    【讨论】:

    • 谢谢。我确实按照链接。为了检查机器上的互联网连接和代理设置,我在下面运行了这个命令 wget ftp.gnu.org/gnu/wget/wget-1.5.3.tar.gz 文件正在成功下载。我需要在git中进行代理设置吗?这些是我所做的设置。 git config --global http.sslVerify false git config --global https.sslVerify false git config --global https.proxy mycred@10.xxx.xxx.xx:8080 git config --global http.proxy mycred@10.xxx.xxx.xx:8080 我仍然看到错误。
    • 您的代理凭据是否包含特殊字符(如@、!、.)?
    • 是的,我的密码中有 _。你认为我应该使用 %5F 而不是 _ 并使用 "git config --global https.proxy myproxy" 设置吗?
    猜你喜欢
    • 1970-01-01
    • 2019-05-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-05-20
    相关资源
    最近更新 更多