Checkout of Git remote aborted because it references a local directory

After updating Jenkins, I now cannot load my shared directory. I get this:

ERROR: Checkout of Git remote ‘D:/xxxxx/git/JenkinsSharedLibrary’ aborted because it references a local directory, which may be insecure. You can allow local checkouts anyway by setting the system property ‘hudson.plugins.git.GitSCM.ALLOW_LOCAL_CHECKOUT’ to true.

Online it says the solution to this is to start Jenkins with -Dhudson.plugins.git.GitSCM.ALLOW_LOCAL_CHECKOUT=true

But that didn’t fix the issue. Any ideas what else I can try?

OK the issue was that -Dhudson.plugins.git.GitSCM.ALLOW_LOCAL_CHECKOUT=true needs to be BEFORE -jar jenkins.war in the command line call. Several examples I saw online did not show that, it had it afterward, which does not work.


Thanks a lot for your feedback @sabibo :pray: .

The nasty downside of this “security feature” is, it seems it must be applied after every update ;-(.

Is there a way, where I can add this “permission” to “/lib/systemd/system/jenkins.service” in a way, where it is kept even on updates?

Yes, the “Managing systemd services” page describes how to create an override that will persist the setting across Jenkins upgrades.

I think it is a mistake to use that setting, since it likely means that you are running jobs on the controller instead of running them on agents. See the “controller isolation” documentation for the reasons that agents are much better than running jobs directly on the controller.

My usage and intention may be not common.
I use jenkins on that machine to run tests, where I want to reduce the “external” influences. That PC is only reachable in a local network, there is no reason to expose it. Nor is there a reason to extend it to execute more or other jobs. Therefore I use local job and fetch from a local git repo in order to relax that external dependencies.