jenkins 没有将文件从 git 上传到 Workspace

jenkins not uploading files from git to Workspace

我确实花了一个小时为我的问题找到解决方案,但我没能找到。 我正在使用 Jenkins 进行一些测试,并在未来将我的项目部署到 AWS。

现在我在 Jenkins 中的 git 配置看起来不错。我的 github 仓库有 link。 但是当我使用“立即构建”并且实际上成功构建作业时,但是当我检查日志时它向我显示:

Started by user unknown or anonymous
Running as SYSTEM
Building in workspace C:\Windows\system32\config\systemprofile\AppData\Local\Jenkins\.jenkins\workspace\test_git
The recommended git tool is: NONE
using credential MyGit
Cloning the remote Git repository
Cloning repository https://github.com/NeoVic2006/Summit_project
 > git.exe init C:\Windows\system32\config\systemprofile\AppData\Local\Jenkins\.jenkins\workspace\test_git # timeout=10
Fetching upstream changes from https://github.com/NeoVic2006/Summit_project
 > git.exe --version # timeout=10
 > git --version # 'git version 2.32.0.windows.2'
using GIT_ASKPASS to set credentials 
 > git.exe fetch --tags --force --progress -- https://github.com/NeoVic2006/Summit_project +refs/heads/*:refs/remotes/origin/* # timeout=10
 > git.exe config remote.origin.url https://github.com/NeoVic2006/Summit_project # timeout=10
 > git.exe config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10
Avoid second fetch
 > git.exe rev-parse "refs/remotes/origin/main^{commit}" # timeout=10
Checking out Revision bb6a87a950e251b83d44296b0d230317ec43056c (refs/remotes/origin/main)
 > git.exe config core.sparsecheckout # timeout=10
 > git.exe checkout -f bb6a87a950e251b83d44296b0d230317ec43056c # timeout=10
ERROR: Unable to retrieve commit message
org.eclipse.jgit.errors.MissingObjectException: Missing unknown bb6a87a950e251b83d44296b0d230317ec43056c
    at org.eclipse.jgit.internal.storage.file.WindowCursor.open(WindowCursor.java:135)
    at org.eclipse.jgit.lib.ObjectReader.open(ObjectReader.java:212)
    at org.eclipse.jgit.revwalk.RevWalk.parseAny(RevWalk.java:1065)
    at org.eclipse.jgit.revwalk.RevWalk.parseCommit(RevWalk.java:975)
    at hudson.plugins.git.util.RevCommitRepositoryCallback.invoke(RevCommitRepositoryCallback.java:25)
    at hudson.plugins.git.util.RevCommitRepositoryCallback.invoke(RevCommitRepositoryCallback.java:13)
    at org.jenkinsci.plugins.gitclient.AbstractGitAPIImpl.withRepository(AbstractGitAPIImpl.java:29)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.withRepository(CliGitAPIImpl.java:86)
    at hudson.plugins.git.GitSCM.printCommitMessageToLog(GitSCM.java:1397)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1363)
    at hudson.scm.SCM.checkout(SCM.java:505)
    at hudson.model.AbstractProject.checkout(AbstractProject.java:1211)
    at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:636)
    at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:508)
    at hudson.model.Run.execute(Run.java:1906)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:97)
    at hudson.model.Executor.run(Executor.java:429)
 > git.exe rev-list --no-walk bb6a87a950e251b83d44296b0d230317ec43056c # timeout=10
[test_git] $ cmd.exe /c call C:\Windows\TEMP\shiningpanda2252295568321242739.bat

C:\Windows\system32\config\systemprofile\AppData\Local\Jenkins\.jenkins\workspace\test_git>python --version  
Python 3.9.7

C:\Windows\system32\config\systemprofile\AppData\Local\Jenkins\.jenkins\workspace\test_git>exit 0 
Finished: SUCCESS

我遇到此错误“错误:无法检索提交消息”,并且我在 Workspace 中没有任何文件。

我确实尝试重新安装 jenkins,我确实尝试将新的 Commit 推送到 github,但仍然出现同样的错误。

有什么解决办法吗?

请具体说明,如果您决定给我 link 另一个 Whosebug 问题,请确保这将是同一个问题。

谢谢, 谢尔盖

我找到了解决方案。问题出在 Jenkins 的根文件夹上。而且我怀疑在我重新安装 Jenkins 后,Jenkins 中的某些项目无法正常工作。 所以我所做的是从 PC 中删除所有 Jenkins 文件并从头开始重新安装它:

如何从 PC 上完全删除:

Open Windows Control Panel and click Programs and Features
Right-click Jenkins x.xxx.x (where x.xxx.x, is the Jenkins version), and select Uninstall.
Follow the directions.
When done, delete the following folders: (note: DO NOT remove the jenkins.jenkins or jenkinswar folders if you want to keep the projects and plugins.)

C:\Program Files\Jenkins or C:\Program Files(x86)\Jenkins 
C:\Windows\System32\config\systemprofile\AppData\Local\Jenkins.jenkins 
C:\Windows\System32\config\systemprofile\AppData\Local\Jenkinswar

Restart the computer.

之后,我在 Jenkins 中重新创建了我的项目,现在一切正常。