我遇到了下面的错误。我能够使用System.setProperty("hudson.plugins.git.GitSCM.ALLOW_LOCAL_CHECKOUT", "true")
设置属性
然而,这一问题仍然存在。有什么指示吗?
ERROR: Checkout of Git remote '<path to project folder>' 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.
发布于 2022-06-19 09:38:21
根据https://issues.jenkins.io/browse/JENKINS-68571
系统属性似乎是在初始化期间读取的,因此在脚本控制台中更改它不会改变它。
在脚本控制台中,直接使用类上的属性:
hudson.plugins.git.GitSCM.ALLOW_LOCAL_CHECKOUT = true
注意,在重新启动期间,系统属性和类属性都不存在。
持久解决方案取决于如何安装/启动Jenkins。
如果您是通过java -jar ...
运行的,请在那里添加系统属性(java -Dhudson.plugins.git.GitSCM.ALLOW_LOCAL_CHECKOUT=true -jar ...
)。
或者,如果您使用系统包管理器安装它,而您的系统使用的是systemd:
$ sudo systemctl edit jenkins
[Service]
Environment="JAVA_OPTS=-Dhudson.plugins.git.GitSCM.ALLOW_LOCAL_CHECKOUT=true"
$ sudo systemctl restart jenkins
发布于 2022-06-19 12:21:20
我找到了我需要的信息,在https://issues.jenkins.io/browse/JENKINS-68571上也可能帮助你。
因此,请遵循以下步骤:
$ sudo systemctl stop jenkins
$ sudo systemctl edit jenkins
[Service]
Environment="JAVA_OPTS=-Dhudson.model.DirectoryBrowserSupport.CSP= -Dhudson.plugins.git.GitSCM.ALLOW_LOCAL_CHECKOUT=true"
$ sudo systemctl restart jenkins
https://stackoverflow.com/questions/72622048
复制相似问题