I have a Git repository that several people are using. I want to enforce a spacing standard (no tabs, if any tabs are present, replace with 3 spaces). Is it possible to enforce this on the server-side (i.e. if someone pushes a file with a tab, have it converted to 3 spaces before it goes in)?
So far I've been trying to write a filter, and I have it working, but as far as I can tell, this is a client side solution.
I have a .gitattributes
file checked into the repository with:
*.py filter=indent
And I've added the following to my config:
[filter "indent"]
clean = sed -i -b 's/\t/ /g' %f
smudge = dir
However, after much searching, I cannot find anyway to "check in" the config entries to the repository. In order for the filter to work, users need to manually add the entries to their config. Is there any way to force config settings for the repository for all users? Or is there some other way this could be done?
So far Can git automatically switch between spaces and tabs? has been were I've gotten most of my info.