Jenkins:错误:获取远程回购'来源时出错

时间:2016-07-15 08:38:43

标签: git jenkins jenkins-plugins

我是詹金斯的相对新手,我试图简单地从存储在Bitbucket上的代码运行构建。我正在使用git。我已将作业源控件设置为https协议,如下所示:   网址:https://myaccount@bitbucket.org/myaccount/myrepo.git   凭证:用户名/密码

' build' section指向根目录中的pom.xml并运行clean test maven目标

我有Git插件2.5.2

我正在运行Jenkins作为Windows服务(Windows 10)。

构建项目的错误是

ERROR: Timeout after 10 minutes
  

git.exe config --local --remove-section credential #timetime = 10   错误:获取远程回购'来源错误   hudson.plugins.git.GitException:无法从https://username@bitbucket.org/username/myrepo.git获取       在hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:799)       在hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1055)       在hudson.plugins.git.GitSCM.checkout(GitSCM.java:1086)       在hudson.scm.SCM.checkout(SCM.java:495)       在hudson.model.AbstractProject.checkout(AbstractProject.java:1270)       在hudson.model.AbstractBuild $ AbstractBuildExecution.defaultCheckout(AbstractBuild.java:604)       在jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)       在hudson.model.AbstractBuild $ AbstractBuildExecution.run(AbstractBuild.java:529)       在hudson.model.Run.execute(Run.java:1720)       在hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:531)       在hudson.model.ResourceController.execute(ResourceController.java:98)       在hudson.model.Executor.run(Executor.java:404)   引起:hudson.plugins.git.GitException:命令" git.exe -c core.askpass = true fetch --tags --progress https://username@bitbucket.org/username/myrepo.git + refs / heads / :refs / remotes /产地/ "返回状态码-1:

欢迎任何建议

2 个答案:

答案 0 :(得分:0)

我在这里回答https://stackoverflow.com/a/43964812/908936

尝试使用

禁用git凭证缓存
git config --global --unset credential.helper

您可能还需要

git config --system --unset credential.helper if this has been set in the system config file

答案 1 :(得分:0)

使用用户名/密码访问存储库的任何特定原因?

更方便和安全的另一种方法是使用ssh。 按着这些次序: 如果尚未完成,请在Jenkins服务器中为您用来访问Bitbucket的用户生成一个rsa密钥。

sudo su <bitbucket user> #if such user not already created, create it first.  
ssh-keygen 

按Enter键询问每个问题。

现在进入主目录中隐藏的.ssh目录,并复制下一步需要粘贴到bitbucket密钥中的公共密钥。
    vi ~/.ssh/id_rsa.pub

现在登录到相同的bitbucket帐户,然后转到:用户配置文件->设置->安全性-> SSH密钥,并将复制在(2)中的公共密钥粘贴到此处。 在您的脚本和设置中,用'ssh'替换您的位桶网址中的'http'

现在再试一次,它应该可以工作。

相关问题