Skip to content

Instantly share code, notes, and snippets.

@mikeslattery
Last active May 15, 2019 21:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikeslattery/c03bb551f33700f8b5b78ed60d699196 to your computer and use it in GitHub Desktop.
Save mikeslattery/c03bb551f33700f8b5b78ed60d699196 to your computer and use it in GitHub Desktop.
#!/bin/bash
# More seemless integration between git-bash/WSL/Cygwin and Docker for Windows
set -euo pipefail
( [ -d 'C:\'] && cygpath . > /dev/null; ) || \
{ echo 'Must be run from GitBash, Msys or Cygwin'; exit 1; }
export MSYS_NO_PATHCONV=1
USER="$(whoami)"
docker run \
-v /host_mnt:/host_mnt -v /:/host \
--rm alpine \
sh "
mkdir -p /host/cygdrive /host/mnt /home
# MSys/Msys2/GitBash
ln -fs /host_mnt/c /host/c
ln -fs /host_mnt/c /host/C
# WSL
ln -fs /host_mnt/c /host/mnt/c
# Cygwin
ln -fs /host_mnt/c /host/cygdrive/c
ln -fs /host_mnt/c /host/cygdrive/C
if [ $HOME = /home/$USER ]; then
ln -fs $(cygpath -w "$HOME" | sed 's|^[cC]:|/host_mnt/c|; s|\\|/|g;') /host/home/$USER
fi
true"
@mikeslattery
Copy link
Author

I no longer like approach and I plan to delete. It's here for reference until thin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment