简体   繁体   English

Jenkins 多分支管道 git 配置错误

[英]Jenkins MultiBranch Pipeline git config error

I've got a multi branch pipeline in jenkins, and when I was setting it up, I cancelled the initial scan of the gitlab branches job by hitting the red cross icon.我在 jenkins 中有一个多分支管道,当我设置它时,我通过点击红叉图标取消了 gitlab 分支作业的初始扫描。

From that point on, I cannot get it to work properly.从那时起,我无法让它正常工作。

I've pasted the error in below.我在下面粘贴了错误。

Here's the things I've tried to fix it.这是我试图解决的问题。

  1. Restarted the software safely through the GUI通过 GUI 安全重启软件
  2. Restarted the container重新启动容器
  3. Removed any folders in workspace folder on master and slave, connected with the git repository删除了主从上工作区文件夹中的所有文件夹,与 git 存储库连接
  4. Searched both machines for any files ending in *.lock, nothing relevant found在两台机器上搜索以 *.lock 结尾的任何文件,没有找到相关内容
  5. Created a new multibranch pipeline and used the same git repo, failed the same way.创建了一个新的多分支管道并使用相同的 git 回购协议,以同样的方式失败。
  6. Created a new multibranch pipeline and used a different git repo but from the same server using the same credentials, worked.创建了一个新的多分支管道并使用了不同的 git 存储库,但来自使用相同凭据的同一服务器,工作正常。

I'm running out of ideas我的想法不多了

It's like there is something cached on the jenkins side for this particular git repo.就好像在这个特定的 git 存储库的 jenkins 端缓存了一些东西。

Does anyone have any further suggestions for things I could try?有人对我可以尝试的事情有任何进一步的建议吗?

Thanks in advance提前致谢

Started by user admin
[Mon May 20 15:38:34 UTC 2019] Starting branch indexing...
 > git --version # timeout=10
using GIT_ASKPASS to set credentials git
 > git ls-remote --symref  # timeout=10
 > git rev-parse --is-inside-work-tree # timeout=10
Setting origin to http://myserver/project.git
 > git config remote.origin.url http://myserver/project.git # timeout=10
ERROR: [Mon May 20 15:38:37 UTC 2019] Could not fetch branches from source 773e986b-d653-49c8-b3eb-7320be14e5aa
hudson.plugins.git.GitException: Command "git config remote.origin.url http://myserver/project.git" returned status code 255:
stdout: 
stderr: error: could not lock config file .git/config: File exists

    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2042)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2010)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2006)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1638)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1650)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.setRemoteUrl(CliGitAPIImpl.java:1284)
    at hudson.plugins.git.GitAPI.setRemoteUrl(GitAPI.java:160)
    at jenkins.plugins.git.AbstractGitSCMSource.doRetrieve(AbstractGitSCMSource.java:352)
    at jenkins.plugins.git.AbstractGitSCMSource.retrieve(AbstractGitSCMSource.java:556)
    at jenkins.scm.api.SCMSource._retrieve(SCMSource.java:374)
    at jenkins.scm.api.SCMSource.fetch(SCMSource.java:284)
    at jenkins.branch.MultiBranchProject.computeChildren(MultiBranchProject.java:634)
    at com.cloudbees.hudson.plugins.folder.computed.ComputedFolder.updateChildren(ComputedFolder.java:277)
    at com.cloudbees.hudson.plugins.folder.computed.FolderComputation.run(FolderComputation.java:165)
    at jenkins.branch.MultiBranchProject$BranchIndexing.run(MultiBranchProject.java:1025)
    at hudson.model.ResourceController.execute(ResourceController.java:97)
    at hudson.model.Executor.run(Executor.java:429)
[Mon May 20 15:38:37 UTC 2019] Finished branch indexing. Indexing took 2.4 sec
FATAL: Failed to recompute children of Foldername » MultiBranchPipeline
hudson.plugins.git.GitException: Command "git config remote.origin.url http://myserver/project.git” returned status code 255:
stdout: 
stderr: error: could not lock config file .git/config: File exists

    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2042)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2010)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2006)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1638)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1650)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.setRemoteUrl(CliGitAPIImpl.java:1284)
    at hudson.plugins.git.GitAPI.setRemoteUrl(GitAPI.java:160)
    at jenkins.plugins.git.AbstractGitSCMSource.doRetrieve(AbstractGitSCMSource.java:352)
    at jenkins.plugins.git.AbstractGitSCMSource.retrieve(AbstractGitSCMSource.java:556)
    at jenkins.scm.api.SCMSource._retrieve(SCMSource.java:374)
    at jenkins.scm.api.SCMSource.fetch(SCMSource.java:284)
    at jenkins.branch.MultiBranchProject.computeChildren(MultiBranchProject.java:634)
    at com.cloudbees.hudson.plugins.folder.computed.ComputedFolder.updateChildren(ComputedFolder.java:277)
    at com.cloudbees.hudson.plugins.folder.computed.FolderComputation.run(FolderComputation.java:165)
    at jenkins.branch.MultiBranchProject$BranchIndexing.run(MultiBranchProject.java:1025)
    at hudson.model.ResourceController.execute(ResourceController.java:97)
    at hudson.model.Executor.run(Executor.java:429)
Finished: FAILURE

Had the same problem: 有同样的问题:

  1. Go to $JENKINS_HOME/caches (on windows it is probably C:\\Program Files (x86)\\Jenkins\\caches) - You will find a few caches, each has .git/config file 转到$ JENKINS_HOME / caches(在Windows上可能是C:\\ Program Files(x86)\\ Jenkins \\ caches)-您会发现一些缓存,每个缓存都有.git / config文件
  2. Read the .git/config until you find the one whose [remote "origin"] points to the git URL of the broken pipeline. 阅读.git / config,直到找到其[remote“ origin”]指向断开管道的git URL的目录。
  3. Remove (or better, rename) this cahce's .git/config & .git/config.lock 删除(或更好地重命名)此cahce的.git / config和.git / config.lock

Worked for me. 为我工作。

Deleting the workspace fixed mine删除工作区修复我的

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM