詹金斯中的 Bitbucket 不工作

Bitbucket in jenkins not working

我正在尝试使用 bitbucket 设置我的 tomcat 项目,该项目位于 git 中。

我有一个安装了 tomcat 和 jenkins 的远程服务器。

我配置javasdk和maven

我使用 bitbicket url 正如许多帖子中的建议

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

但是当它构建时抛出这个:

    Started by user anonymous
Building in workspace /root/.jenkins/jobs/PROJECT/workspace

git rev-parse --is-inside-work-tree # timeout=10 Fetching changes from the remote Git repository git config remote.origin.url https://USER:mypass@bitbucket.org/USER/PROJECT.git # timeout=10 Fetching upstream changes from https://USER@bitbucket.org/USER/PROJECT.git git --version # timeout=10 git fetch --tags --progress https://USER@bitbucket.org/USER/PROJECT.git +refs/heads/:refs/remotes/origin/ ERROR: Error fetching remote repo 'origin' hudson.plugins.git.GitException: Failed to fetch from https://USER@bitbucket.org/USER/PROJECT.git at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:735) at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:983) at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1016) at hudson.scm.SCM.checkout(SCM.java:485) at hudson.model.AbstractProject.checkout(AbstractProject.java:1282) at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:610) at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:532) at hudson.model.Run.execute(Run.java:1744) at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:529) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:374) Caused by: hudson.plugins.git.GitException: Command "git fetch --tags --progress https://USER@bitbucket.org/USER/PROJECT.git +refs/heads/:refs/remotes/origin/" returned status code 128: stdout: stderr: error: The requested URL returned error: 401 while accessing https://USER@bitbucket.org/USER/PROJECT.git/info/refs

严重:HTTP 请求失败

at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1591)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1379)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access0(CliGitAPIImpl.java:86)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.execute(CliGitAPIImpl.java:324)
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:733)
... 11 more

错误:获取远程仓库时出错 'origin' 已完成:失败

请帮忙!

我终于让它可以在根文件夹中创建文件 .netrc。

我用过这个linkTUTORIAL

然后在 jenkins

中使用简单的 bitbucket url

https://bitbucket.org/user/project.git

我用的是 CentOs