.gitignore is not working in jenkins jobs and unnecesary folders/fields are being included in the repo

Then I suggest to add the .gitignore to your repo. Then you don’t need to care if you move the build to a different machine, people that start using the repo for the first time don’t need any manual things to ensure they have a proper .gitignore somewhere else.