# Jenkins 构建的时候提示 org.eclipse.jgit.internal.storage.file.FileSnapshot 错误

**URL:** <https://www.isharkfly.com/t/jenkins-org-eclipse-jgit-internal-storage-file-filesnapshot/14004>\
**Category:** DevOps\
**Tags:** jenkins\
**Created:** [June 13, 2022, 8:07pm UTC](https://www.isharkfly.com/t/jenkins-org-eclipse-jgit-internal-storage-file-filesnapshot/14004 "2022-06-13T20:07:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![honeymoose](https://www.isharkfly.com/user_avatar/www.isharkfly.com/honeymoose/32/20796_2.png) [@honeymoose](https://www.isharkfly.com/u/honeymoose)\
**Post date:** [June 13, 2022, 8:07pm UTC](https://www.isharkfly.com/t/jenkins-org-eclipse-jgit-internal-storage-file-filesnapshot/14004/1 "2022-06-13T20:07:38Z")

</div>

错误的信息如下：

```auto
java.lang.NoClassDefFoundError: Could not initialize class org.eclipse.jgit.internal.storage.file.FileSnapshot
	at org.eclipse.jgit.storage.file.FileBasedConfig.<init>(FileBasedConfig.java:88)
	at org.eclipse.jgit.util.SystemReader$Default.openJGitConfig(SystemReader.java:132)
	at org.eclipse.jgit.util.SystemReader.getJGitConfig(SystemReader.java:338)
	at org.eclipse.jgit.util.SystemReader.getSystemConfig(SystemReader.java:363)
	at org.eclipse.jgit.util.SystemReader.getUserConfig(SystemReader.java:311)
	at org.eclipse.jgit.internal.storage.file.FileRepository.<init>(FileRepository.java:161)
	at org.eclipse.jgit.lib.BaseRepositoryBuilder.build(BaseRepositoryBuilder.java:625)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.getRepository(CliGitAPIImpl.java:3407)

```

![git-error-01](https://www.isharkfly.com/images/transparent.png)

## 问题和解决

上面的问题在于你的 Git 版本没有办法和 Jenkins 进行兼容。

你需要在 Jenkins 的插件管理中，对 Git 进行升级下就可以了。

---

<div class="post-metadata">

**Author:** ![zixiao2013](https://www.isharkfly.com/letter_avatar_proxy/v4/letter/z/ed655f/32.png) [@zixiao2013](https://www.isharkfly.com/u/zixiao2013)\
**Post date:** [June 13, 2022, 8:08pm UTC](https://www.isharkfly.com/t/jenkins-org-eclipse-jgit-internal-storage-file-filesnapshot/14004/2 "2022-06-13T20:08:51Z")

</div>

我们也遇到了这个问题。

我们开始还以为是项目有了问题，后来发现所有项目都没有办法构建了才觉得有可能是 Git 插件的问题。
