[Jenkins] Jenkins not able to fetch code from remote git

When change OS user to run a Jenkins. I found am error when clone source code to workspace directory

Error Message

stderr: fatal: detected dubious ownership in repository at ...... 

Solution

  • Clear Old File and Folder which create by another user on Jenkins Job's "Configure"
    • Source Code Management > Git > Additional Behaviors, add a behavior "Wipe out repository & force clone" Save & Build
    • Or in Jenkins Pipeline add cleanWs() << need plugin Workspace Cleanup Plugin (jenkins.io)
  • NOTE for Windows: Check which user that run Jenkins. if you start Jenkins which Local System Account Please Change to another account

Reference


Discover more from naiwaen@DebuggingSoft

Subscribe to get the latest posts sent to your email.