Skip to content

Instantly share code, notes, and snippets.

@ferventcoder
Last active March 24, 2024 01:42
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save ferventcoder/7995025 to your computer and use it in GitHub Desktop.
Save ferventcoder/7995025 to your computer and use it in GitHub Desktop.
Git Symlinks POSIX vs Windows - Fixes Permission Denied issues when you share a repository as part of your Shared Folders with one or more Windows VMs.
# This fixes Permission denied errors you might get when
# there are git symlinks being used on repositories that
# you share in both POSIX (usually the host) and Windows (VM).
#
# This is not an issue if you are checking out the same
# repository separately in each platform. This is only an issue
# when it's the same working set (aka make a change w/out
# committing on OSX, go to Windows VM and git status would show
# you that change).
#
# Based on this answer on stack overflow: http://stackoverflow.com/a/5930443/18475
#
# No warranties, good luck
$symlinks = &git ls-files -s | gawk '/120000/{print $4}'
foreach ($symlink in $symlinks) {
write-host $symlink
&git update-index --assume-unchanged $symlink
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment