I am using Ubuntu on my workstation and whenever I try to commit/push to a Mercurial repository located on a CIFS share in my LAN, I get this error thrown: abort: Operation not permitted: /media/repos/myRepo/.hg/journal.dirstate
However, prepending any command that causes this with sudo, will let mercurial continue without throwing any errors at me.
What should I do stop having to sudo every commit?
Your user doesn’t have write permissions for
/media/repos/myRepo. You can check the owner and permissions usingls -la. Depending on the result of that you should either:Try changing the permissions with
chmodto allow access by your user or group.(
ug+wmeans add write permissions for the group and the owner user, this will work if you’re in the same group as the owner. Otherwise, you could try just+wwhich will add it for all users, but this is less secure.)Try changing the owner with
chownto your user or group.(Both
myuserandmygroupare optional)Also be sure to use
chownandchmodrecursively on the entire repository. Ifjournal.dirstateis recreated every time (which I think is what happens), it inherits its permissions from the.hgdirectory, so any permissions you change on the file itself may get lost.