Spring
源码调试错误修复
文章目录
- `Spring` 源码调试错误修复
- 1. `fatal: not a git repository (or any of the parent directories): .git`
- 问题描述
- 解决方案
- 2. `fatal: Needed a single revision`
- 问题描述
- 解决方案
1. fatal: not a git repository (or any of the parent directories): .git
问题描述
描述:执行
Load Gradle Changes
时,控制台出现错误,错误描述如下
控制台输出如下:
fatal: not a git repository (or any of the parent directories): .git
Build scan background action failed.
org.gradle.process.internal.ExecException: Process 'command 'git'' finished with non-zero exit value 128
at org.gradle.process.internal.DefaultExecHandle$ExecResultImpl.assertNormalExitValue(DefaultExecHandle.java:431)
at org.gradle.process.internal.DefaultExecAction.execute(DefaultExecAction.java:38)
at org.gradle.process.internal.DefaultExecActionFactory.exec(DefaultExecActionFactory.java:202)
at io.spring.ge.conventions.gradle.WorkingDirectoryProcessOperations.exec(WorkingDirectoryProcessOperations.java:45)
at io.spring.ge.conventions.gradle.ProcessOperationsProcessRunner.run(ProcessOperationsProcessRunner.java:40)
at io.spring.ge.conventions.gradle.BuildScanConventions.run(BuildScanConventions.java:195)
at io.spring.ge.conventions.gradle.BuildScanConventions.addGitMetadata(BuildScanConventions.java:139)
at com.gradle.enterprise.gradleplugin.internal.extension.a$4.run(SourceFile:172)
at com.gradle.scan.plugin.internal.b.a.b(SourceFile:25)
at org.gradle.internal.enterprise.impl.DefaultGradleEnterprisePluginBackgroundJobExecutors.runWithInputTrackingDisabled(DefaultGradleEnterprisePluginBackgroundJobExecutors.java:70)
at org.gradle.internal.enterprise.impl.DefaultGradleEnterprisePluginBackgroundJobExecutors.lambda$executeUserJob$0(DefaultGradleEnterprisePluginBackgroundJobExecutors.java:64)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
at org.gradle.internal.concurrent.AbstractManagedExecutor$1.run(AbstractManagedExecutor.java:47)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)
解决方案
fatal: not a git repository (or any of the parent directories): .git
问题关键在于这样一句话,这不是一个git
仓库,于是想到的解决方案是初始化一个git
库。
在控制台输入如下指令即可解决问题
git init
2. fatal: Needed a single revision
问题描述
在上述操作执行完毕后,再次执行
Load Gradle Changes
时,控制台出现报错
控制台输出如下:
fatal: Needed a single revision
Build scan background action failed.
org.gradle.process.internal.ExecException: Process 'command 'git'' finished with non-zero exit value 128
at org.gradle.process.internal.DefaultExecHandle$ExecResultImpl.assertNormalExitValue(DefaultExecHandle.java:431)
at org.gradle.process.internal.DefaultExecAction.execute(DefaultExecAction.java:38)
at org.gradle.process.internal.DefaultExecActionFactory.exec(DefaultExecActionFactory.java:202)
at io.spring.ge.conventions.gradle.WorkingDirectoryProcessOperations.exec(WorkingDirectoryProcessOperations.java:45)
at io.spring.ge.conventions.gradle.ProcessOperationsProcessRunner.run(ProcessOperationsProcessRunner.java:40)
at io.spring.ge.conventions.gradle.BuildScanConventions.run(BuildScanConventions.java:195)
at io.spring.ge.conventions.gradle.BuildScanConventions.addGitMetadata(BuildScanConventions.java:139)
at com.gradle.enterprise.gradleplugin.internal.extension.a$4.run(SourceFile:172)
at com.gradle.scan.plugin.internal.b.a.b(SourceFile:25)
解决方案
fatal: Needed a single revision
问题关键在于这样一句话,这个错误通常是由于git
仓库缺少所需要的提交记录导致的,解决方案是确保现在正在访问正确的分支或提交记录,或者尝试从其他可用分支或提交记录中获取代码。
执行以下指令,即可解决问题
git add .
git commit -m "first commit"