Skip to content

File visibility, permissions, and Git worktree path issues when operating on Windows mounted directories (/mnt/...) via WSL #16991

@cywwycedward

Description

@cywwycedward

Question

Description
According to the official documentation and best practices of opencode, it is recommended to install the tool in a Linux environment for the best experience. For Windows users, the official recommendation is to use WSL.

However, I am currently facing an issue regarding cross-file-system operations. My project is located in a Windows directory (e.g., drive D:\), and I am accessing it via the mounted path in WSL (e.g., /mnt/d/...).

When opencode performs operations in this mounted directory, I encounter the following problems:

  1. File Visibility: Newly created files by the agent sometimes cannot be found directly or immediately in the Windows directory.
  2. Permission Inconsistencies: There seem to be permission conflicts (POSIX vs NTFS), leading to occasional errors when the agent tries to read/write.
  3. Git Worktree Path Resolution: When the agent creates a git worktree in the mounted directory, it becomes unusable/unviewable on the Windows side. Because it is created inside WSL, the worktree's internal .git configuration stores the absolute WSL path (/mnt/d/...) instead of the Windows path (D:\...). As a result, Windows-based Git clients and editors fail to recognize the paths.

Environment

  • OS: Windows 11 with WSL2 (Ubuntu)
  • Project Location: Windows native drive (accessed via /mnt/d/... in WSL)

Questions

  1. How can I handle the git worktree path mismatch between WSL and Windows? Is there a recommended way to force relative paths or map the paths correctly so that both systems can recognize the worktree?
  2. If my workflow requires keeping the project in the Windows directory, what is the best practice or recommended configuration (e.g., modifying wsl.conf or Git settings) to resolve these issues?

Any guidance or suggestions would be greatly appreciated. Thank you!

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions