首页 文章

Jenkins:错误:获取远程仓库时出错'origin'

提问于
浏览
0

我是詹金斯的相对新手,我试图简单地从存储在Bitbucket上的代码运行构建 . 我正在使用git . 我已将作业源控件设置为https协议为:url:https://myaccount@bitbucket.org/myaccount/myrepo.git credentials:username / password

'build'部分指向根目录中的pom.xml并运行干净的测试maven目标

我有Git插件2.5.2

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

构建项目的错误是

ERROR: Timeout after 10 minutes

git.exe config --local --remove-section credential #timetime = 10错误:获取远程repo'origin'时出错hudson.plugins.git.GitException:无法从https://username@bitbucket.org/username获取/myrepo.git at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:799)at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1055)at hudson.plugins.git.GitSCM.checkout(GitSCM) .java:1086)在hudson.model.AbstractProject.checkout(AbstractProject.java:1270)的hudson.m.Sl.lunk上创建了hudson.m.Sr.Lout的一个hudson.scm.SCM.checkout(SCM.java:495)$ AbstractBuildExecution.defaultCheckout(AbstractBuild.java: 604)at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)at hudson.model.AbstractBuild $ AbstractBuildExecution.run(AbstractBuild.java:529)at hudson.model.Run.execute(Run.java:1720)at at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:531)at hudson.model.ResourceController.execute(ResourceController.java:98)at hudson.model.Executor.run(Executor.java:404)引起:hudson.plugi ns.git.GitException:命令“git.exe -c core.askpass = true fetch --tags --progress https://username@bitbucket.org/username/myrepo.git refs / heads /:refs / remotes / origin /“返回状态码-1:

欢迎任何建议

2 回答

  • 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
    
  • 0

    使用用户名/密码访问回购的任何特定原因?

    另一种更方便和安全的方法是使用ssh . 请执行以下步骤:如果尚未完成,请在Jenkins服务器中为您用于访问bitbucket的用户生成一个rsa密钥 .

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

    每个问题都按Enter键 .

    现在到了home中隐藏的.ssh目录并复制你需要在下一步中粘贴bitbucket键的公钥 .
    vi ~/.ssh/id_rsa.pub

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

    现在再试一次,它应该工作 .

相关问题