Score:1

How to sync Ubuntu WSL and MINGW home directory for me

in flag

So I'm used to using the Git for Windows mingw and have ssh keys setup there.

Recently adopted Ubuntu 18 on WSL (Windows subsystem for linux) and realized that the home folder in the Ubuntu is different from the home folder for MinGW

MinGW is using my actual Windows home folder (typically C:\Users\eric) and the ssh folder being in C:\Users\eric.ssh

Ubuntu WSL is using a different folder for /home/eric and my .ssh in Ubuntu is clearly not the same folder.

Knowing that windows processes editing the home folder for files exposed in WSL is not supported right now (VolFS metadata sync issues, google it) however, it would be nice to at least keep my .ssh folder in sync.

What would be the proper way to do this?

I dont see how MinGW mounts the home folder, and I dont see how to move Ubuntu's home folder reference (or at least .ssh folder) to C:\Users\eric.ssh

Score:1
vn flag

Knowing that windows processes editing the home folder for files exposed in WSL is not supported right now (VolFS metadata sync issues, google it)

If you are referring to this issue or a derivative of it, then note that the problem was solved a long time ago (as noted in that Microsoft blog post) with the creation of a DrvFs access method for WSL. From Git Bash, you would use:

cd //wsl\$/Ubuntu-18.04
# Substitute proper distro name if needed

I definitely don't recommend "moving" either home folder (i.e. attempting to use either system's folder as the other's home), personally. You are likely to run into permission/ownership issues, different UID/GIDs, etc. "Syncing" the two instead would be a much better strategy, IMHO.

However, this question has come up in the past, and the general recommendation is to use a git repository for storing/syncing your shared configuration files between "hosts" (WSL/Ubuntu and Git Bash in this case). There are a number of utilities designed to make this easier, with a nice list here. I have not personally used any of them, but I've read good things about GNU Stow.

Note: From your profile, it sounds like you have far more expertise in git than I do, but it seems to me that (if desired) you could create a hook so that whenever you pushed a changed to the config repo on the Git Bash side, it automatically would run something like:

wsl -e sh -c "git --git-dir=$HOME/.dotfiles pull

This uses the wsl command in Windows to call a command in your Ubuntu instance. You'd need some way to only run the hook when you committed from Git Bash, though. Or you might be able to script it such that it called git in Git Bash if the commit was done in WSL/Ubuntu, and vice-versa.

Or that might be overkill/over-architecure ;-)

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.