首页 > 其他分享 >Jenkins持续集成报错stderr: fatal: unsafe repository (‘/home/water/water‘ is owned by someone else)

Jenkins持续集成报错stderr: fatal: unsafe repository (‘/home/water/water‘ is owned by someone else)

时间:2023-01-03 12:03:51浏览次数:44  
标签:someone java -- hudson water CliGitAPIImpl git 报错


项目场景:

为了方便后期对项目进行修改,采用Jenkins持续集成工具自动​​build​​运行Maven项目。


问题描述

初次构建时报错:

Started by user water
Running as SYSTEM
Building in workspace /home/water/water
The recommended git tool is: NONE
using credential Honyelchak
Cloning the remote Git repository
Cloning repository https://xxxxxxxxx.git
> git init /home/water/water # timeout=10
Fetching upstream changes from https://xxxxxxxxx.git
> git --version # timeout=10
> git --version # 'git version 2.25.1'
using GIT_ASKPASS to set credentials gitee
> git fetch --tags --force --progress -- https://xxxxxxxxx.git +refs/heads/*:refs/remotes/origin/* # timeout=10
ERROR: Error cloning remote repo 'origin'
hudson.plugins.git.GitException: Command "git fetch --tags --force --progress -- https://xxxxxxxxx.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout:
stderr: fatal: unsafe repository ('/home/water/water' is owned by someone else)
To add an exception for this directory, call:

git config --global --add safe.directory /home/water/water

at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2671)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:2096)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$500(CliGitAPIImpl.java:84)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:618)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:847)
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1216)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1294)
at hudson.scm.SCM.checkout(SCM.java:540)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1217)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:647)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:85)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:519)
at hudson.model.Run.execute(Run.java:1897)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:543)
at hudson.model.ResourceController.execute(ResourceController.java:101)
at hudson.model.Executor.run(Executor.java:442)
ERROR: Error cloning remote repo 'origin'
Finished: FAILURE

原因分析:

原因是​​jenkins:jenkins​​​对文件夹​​/home/water/water​​没有权限!


解决方案:

给​​jenkins​​所属的用户赋予权限

​chown -R jenkins:jenkins /home/water/water​

  • 用户一般不修改的话是​​jenkins:jenkins​
  • ​/home/water/water​​ 为所指的文件夹


标签:someone,java,--,hudson,water,CliGitAPIImpl,git,报错
From: https://blog.51cto.com/u_13758447/5985132

相关文章