I'm using GitHub Desktop v.2.6.9(x64) for Windows 10, with WSL2 Linux Ubuntu 20.04 LTS. The GitHub Desktop installed in Windows, but git repo and all the code and development happens in Linux partition, by VS Code and extension "Remote - WSL" by Microsoft, both installed in Windows partition. I can see my GitHub repo saved in Linux partition in GitHub Desktop, but when I try to change branch, I'm getting Error window, with the famous Warning "LF will be replaced by CRLF in …" for many files.
I can't change branch in GitHub Desktop, every time I'm trying to do it, the Switch Branch window appears, saying "You have changes on this branch. What would you like to do with them?" and 2 options Leave my changes on current branch, or Bring my changes to new branch. I choose Leave option, but can't actually change the branch - the same Error window with the same Warning appears again. It's very annoying. There is a lot of pages related to fix like this one. To fix this problem, I try to run in the Ubuntu terminal:
git config --global core.autocrlf true <-doesn't fix the warning when changing branches
git config --global core.autocrlf input <-doesn't fix the warning when changing branches either
git config --global core.autocrlf false <-doesn't fix the warning when changing branches either
I restart my GitHub Desktop after every change and try it, and the result is the same every time.
My guess that as GitHub Desktop is installed for Windows (not for Ubuntu, with xming or other x-server), it uses it local settings, saved somewhere in Windows partition, and ignores whatever changes I do in Linux git config. Is it the case? And how to fix it for this setup (Github Desktop is installed for Windows, and git and repo files - for Linux Ubuntu, with WSL2).
UPD: the partial workaround is to install xserver in windows, connect via putty to local Ubuntu with x11 forwarding allowed, install GitHub Desktop in Linux partition, and use it. In that case there is no Warning 'LF will be replaced by CRLF' problem, when I try to change branch. But WSL2 Ubuntu changes IP address every time it's re-started, which is not very convenient for frequent Putty connection.