This happened to me and whilst I solved the problem using fragments of information I found here, I didn't find a simple clear answer - so here's the problem stated and answered.
I have a Jenkins CI job that is failing:
Command "git clean -ffdx" returned status code 1:
In my case because of difficulties removing Go packages:
stdout:
stderr: warning: failed to remove go/pkg/mod/github.com/jfrog/build-info-
go@v1.6.0/build/testdata/npm/_cacache/content-v2/sha512/32/d8: Permission denied
warning: failed to remove go/pkg/mod/github.com/jfrog/build-info-
go@v1.6.0/build/testdata/npm/_cacache/content-v2/sha512/75/67: Permission denied
How can I fix this?