0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Jenkins(windows)でgitのエラー

Last updated at Posted at 2018-01-11

概要

昨日まで問題なくJenkinsのビルドが動いていたのに、突然ビルドができなくなってしまいました。
ビルドのログを確認したところ、以下の様なエラーが発生していました。

 > git.exe rev-parse --is-inside-work-tree # timeout=10
ERROR: Workspace has a .git repository, but it appears to be corrupt.
hudson.plugins.git.GitException: Command "git.exe rev-parse --is-inside-work-tree" returned status code 128:
stdout: 
stderr: fatal: bad config line 1 in file .git/config

	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1784)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1757)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1753)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1409)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1421)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.hasGitRepo(CliGitAPIImpl.java:196)
	at hudson.plugins.git.GitAPI.hasGitRepo(GitAPI.java:232)
	at jenkins.plugins.git.AbstractGitSCMSource.doRetrieve(AbstractGitSCMSource.java:185)
	at jenkins.plugins.git.AbstractGitSCMSource.retrieve(AbstractGitSCMSource.java:214)
	at jenkins.scm.api.SCMSource.fetch(SCMSource.java:247)
	at org.jenkinsci.plugins.workflow.multibranch.SCMBinder.create(SCMBinder.java:75)
	at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:215)
	at hudson.model.ResourceController.execute(ResourceController.java:98)
	at hudson.model.Executor.run(Executor.java:404)
Creating git repository in C:\Program Files (x86)\Jenkins\caches\git-7dd8566e7a711901887efa9299fa2e2d

対処

ログに出力されていたパス(上記ログの最終行に出ています)を確認してみると、.gitディレクトリがあり、エラーメッセージにあるようにconfigファイルがおかしなことになっていました。(テキストエディタで開けなくなっていました)

そこでcachesディレクトリ配下を一旦削除したところ、ビルド実行できるようになりました。

補足

問題となったジョブはMultibranch Pipelineで構成しています。
定期的に対象リポジトリが更新されているかをチェックするようになっていますが、その処理でこけていたようです。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?