gittabstop

Git/Bash in Windows changes tabwidth


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.


Solution

  • joanis answer was correct and led me to the solution.

    I solved the issue by adding the set expandtab to my .vimrc which converts tabs into the number of spaces you set with set tabstop and set shiftwidth.
    So I can do in vim and it produces actually two spaces instead of a real tab.
    If I don't use set expandtab the tab is only 2 spaces wide, but it still is a tab and behaves differently in gitlab.