I added and commited a branch locally (in a Docker container mounted as volume and locally in Windows).
The file contained tabs which had a width of 2 spaces. (they had two spaces in neovim and in Visual Studio Code)
Then I pushed that Branch onto gitlab.
And in gitlab the tabs I added to that file had a width of 8 spaces.
I tried using the autocrlf option in .gitconfig but it did not seem to have an effect.
I did the add and commit inside the Docker container.
But the git push I had to do in gitbash because of authentication issues.
Since I still see two spaces in my local file and in the Docker container it must be the git push from gitbash that changed the tabwidth.
Git/Bash in Windows changes tabwidth
117 views Asked by theerrormagnet At
1
joanis answer was correct and led me to the solution.
I solved the issue by adding the
set expandtabto my.vimrcwhich converts tabs into the number of spaces you set withset tabstopandset shiftwidth.So I can do in vim and it produces actually two spaces instead of a real tab.
If I don't use
set expandtabthe tab is only 2 spaces wide, but it still is a tab and behaves differently ingitlab.