CheckMK remote git configuration

Hi, I am interested in remote git for checkmk configuration.
In general: repo in Azure DevOps, authorization via ssh, and post commit hook.
Issue passwords.mk file is committed too , and I don’t wan’t to keep that info in git.
Edited by hands .gitignore in folder is overwritten by mk and file committed again.
Question: how to permanently exclude password.mk from git?

You could try setting up the site users’ .gitignore file and prefix the line with a !, that should instruct it to override the gitignore supplied by cmk, eventhough it’s on a deeper level.

Instead of a .gitignore file (which usually is checked in) you could create/edit the local file .git/info/exclude. The file has the same syntax as the .gitignore files but is NOT checked in. It’s just local to the repository. I haven’t tried but I strongly doubt checkmk will overwrite this file.
Also, you wil have to untrack passwords.mk:

git rm --cached path/to/passwords.mk
git commit -m "untrack passwords.mk"
1 Like

mk just ignores it, devs hardcoded “git add --all”. Support tells that fixing this is a paid feature …

Hi, maybe you can use a pre-commit hook to remove the password file before the commit:

The pre-commit hook is run first, before you even type in a commit message. It’s used to inspect the snapshot that’s about to be committed, to see if you’ve forgotten something, to make sure tests run, or to examine whatever you need to inspect in the code. Exiting non-zero from this hook aborts the commit, although you can bypass it with git commit --no-verify. You can do things like check for code style (run lint or something equivalent), check for trailing whitespace (the default hook does exactly this), or check for appropriate documentation on new methods.

https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed. Contact @fayepal if you think this should be re-opened.