Permission denied error when overwritting files to DVC tracked directory

Hi there,
I’m still figuring DVC out so sorry if this is an obvious question. I feel like I’m missing something.

I have a project where some directories are tracked with DVC.
When someone reruns a script that overwrites existing files inside a DVC tracked directory we get “Permission denied error”. If we try to manually modify the same file with the vim editor we get that the file is flagged as readonly but we can force writting the file and it gets modified. But when we check file permissions on the file they all seem to be set properly. If we delete all files and rerun the script regenerating the files everything works fine again.

Is this how DVC is supposed to work? Shouldn’t we be able to overwrite files and then add the changes to the DVC tracked directory and then push them?

Many thanks in advance!

What platform are you running on (windows/linux/mac) and what dvc command in the script is giving you the permission error? It would also help if you could run dvc doctor in the repo where you get the errors and post the output here.

One possibility I can think of is that if you are using the hardlink or symlink cache link type setting, you need to be using dvc unprotect before you try and edit or write to the dvc-tracked files: unprotect

1 Like

Many thanks @pmrowla. I am indeed using symlinks. I’ll check that. Thanks!