git - Jenkins 中的 Bitbucket 不工作

标签 git maven tomcat jenkins bitbucket

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

我有一个远程服务器,我在其中安装了 tomcat 和 jenkins。

我配置了 java sdk 和 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.access$300(CliGitAPIImpl.java:86)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:324)
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:733)
... 11 more

错误:获取远程仓库“来源”时出错 完成:失败

请帮忙!

最佳答案

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

我使用了这个链接 TUTORIAL

然后在 jenkins 中使用简单的 bitbucket url

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

我用的是 CentOs

关于git - Jenkins 中的 Bitbucket 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31323899/

相关文章:

php - Apache 允许 php 运行 `git pull`

git - 从 Git 存储中查找并提取文件

添加到 .gitignore 后,git 仍然显示已修改的文件

java - Java WebApp 的 Azure GIT 持续部署

带有 Tomcat 8.0.5 的 JavaMelody 1.52.0 - 未找到监控

java - 如何延迟所有tomcat服务器请求

Git 通过代理。克隆时出现 407 错误的原因是什么?

jsp - 如何使用 Maven war 插件在 war 之间重用 war 资源

java - Maven:多模块 WAR 构建为库项目提供 "Unable to find main class"

Docker 容器无法访问 Mac 上本地托管的 Tomcat