diff --git a/pkgs/build-support/fetchgit/nix-prefetch-git b/pkgs/build-support/fetchgit/nix-prefetch-git index 8110d670e41c..5a1506ddad33 100755 --- a/pkgs/build-support/fetchgit/nix-prefetch-git +++ b/pkgs/build-support/fetchgit/nix-prefetch-git @@ -300,7 +300,9 @@ clone_user_rev() { local rev="${3:-HEAD}" if [ -n "$fetchLFS" ]; then - HOME=$TMPDIR + tmpHomePath="$(mktemp -d -p nix-prefetch-git-tmp-home-XXXXXXXXXX)" + exit_handlers+=(remove_tmpHomePath) + HOME="$tmpHomePath" git lfs install fi @@ -408,6 +410,10 @@ remove_tmpPath() { rm -rf "$tmpPath" } +remove_tmpHomePath() { + rm -rf "$tmpHomePath" +} + if test -n "$QUIET"; then quiet_mode fi