How to avoid warning 'LF will be replaced by CRLF' in git? - wsl-2

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.

Related

How to connect to git repository in a remote Linux machine using Visual Studio 2017?

I have a git repository installed in a remote Linux server, but would like to work on it and sync my changes to the git repository using Visual Studio Community Edition 2017.
Apologies if this is a repeat question; am new to this and have looked at the existing answers on SO but don't seem to have found a direct answer for this.
I have managed to use Team Explorer to connect directly to github, but would prefer to connect to the git repository on the Linux server instead.
Thank you.
Let's say you have a user on the linux machine, with a projects subfolder in your home directory, and under that you have a git project in a folder called myproject.
You should be able to run git clone username#server:projects/myproject at any remote terminal (including windows with git installed), assuming you have an ssh server enabled on the linux server above (you may have to install openssh-server first).

Linking my own Git server with my Windows Eclipse IDE

I'm trying since two days to set up a private Git and link it with my Eclipse IDE.
First of all, I have a Raspberry running Rasbian as a server. SSH is working with SSH keys.
I created a new user to store my Git projects on. Git is installed too.
My dev computer is running Windows 10 and Eclipse Neon.1 with the Git plugin installed on. I have MSysGit installed too.
And here I can't link anything to make it working well together.
First, I didn't find how can I tell to EGit to use a SSH key. So I wanted to use the Git GUi provided by MSysGit but I don't know how to link it with my server.
I'm not here to ask you to setting up for me or even tell me how to do it step by step, I'm just looking for a detailled tutorial or video which can helps me with it. Most of tutorial I rode use Linux as dev OS, or link Eclipse directly on GitHub so I didn't find a situation like mine.
First you need git setting done in eclipse that provide GUI for git commands.
Then to link local server, add you local git server URL to your project remote URL. and it should be able to pull & push commit to your server.
This tutorial should be enough for all you need.
http://www.vogella.com/tutorials/EclipseGit/article.html
http://monkeyhacks.com/post/raspberry-pi-as-private-git-server

Issues with sharing repository between linux and windows

I am sharing my repository between my linux and windows machine and pushed some permission changes on my linux machine.
Now my windows machine says I'm up-to-date when doing this:
git fetch -all
git reset --hard origin/master
git pull
yet when I attempt to do the following:
git checkout dev
It suddenly tells me I have local changes, which just so happen to be the same files of which I modified the permissions on my linux machine.
What is the right way of dealing with this? I made those permission changes so I don't have to manually use chmod every time I pull on my linux machine.
Try setting core.fileMode to false on Windows, then the executable bit is ignored for the windows repo.

Shared folder between Windows host and Ubuntu guest, long filenames

I'm setting up an Ubuntu guest under Windows using VirtualBox for a colleague to provide him with a Linux-based development environment for a node.js application.
This colleague of mine can't or doesn't want to SSH into the VM and work in emacs or vim; he's a Sublime Text guy. So I have set up the project tree in a VirtualBox shared folder so he can access it from Windows (to edit) and the Linux VM (to build/test).
Unfortunately, npm install fails with file system errors. The problem seems to be extremely long path names resulting from deeply nested node_modules dependencies. I'm guessing we're hitting a Windows limit on filename length. The npm install works just fine in a regular (non-shared) directory in the VM.
Does anyone have ideas about how to deal with this problem? One idea I had was to somehow alias or link $MY_PROJECT/node_modules to another, non-shared location, but I can't figure out how to do that.
Update: I'm going to try this hack: https://www.virtualbox.org/ticket/11976.
Update 2: Ended up using samba, which is probably what I should have done in the first place.
One option is to use one of the multiple ways for sublime to edit remote files over ssh, covered in some detail here
How to use Sublime over SSH
Another is try using the native windows version of node and have your colleague develop locally directly under windows.

Git/Egit configs

I am trying to migrate to git and would like to stay inside my familiar IDE (Eclipse), and apparently Egit is the plugin to use.
A few questions:
Does Egit require git? Meaning, do I need to first install git on my machine, prior to installing the Egit plugin?; and
If the answer to #1 above is "yes", and I do need to first install git, then after I install git, are there any system-level configurations, or git commands (to be ran from the shell) that I need to perform before I install Egit? Note I do plan on using a private repo on GitHub which I believe uses SSL keys...if that changes the answer to this question at all...
Also I'm on Ubuntu Desktop 12.04 - just fyi in case there are linux-specific settings, etc.
Thanks in advance!
No, EGit does not require Git as it is based JGit, which is a pure Java implementation of Git.

Resources