Today I created a new Mercurial repository on a Windows server. I cloned it, made some changes, tried to push, and was greeted with this:
C:\myapplication>hg push
pushing to http://servername/myapplication
searching for changes
abort: HTTP Error 500: .hg\store0changelog.i: Access is denied
My user account had write permission to the myapplication folder on the server, and the odd thing is that I’ve created repositories there before and never had a problem pushing changes. I compared 00changelog.i to the same file in another repository that was working. Turns out I was using anonymous authentication and IUSR was missing write permission. I gave full control to IUSR on hg\store folder and…
C:\myapplication>hg push
pushing to http://servername/myapplication
searching for changes
remote: adding changesets
remote: adding manifests
remote: adding file changes
remote: added 1 changesets with 114 changes to 114 files
Success!
If you’re having problems pushing to a central server with Mercurial, make sure the IIS anonymous authentication account (IUSR or IUSR_MachineName) you have write permission to the hg\store folder and subfolders in your repository.
IUSR is the anonymous internet user. The properties on this account specify what rights an anonymous user to your web site has. It is possible that giving this user write permissions would present a security risk. In this circumstance it is the only choice. However, if you have multiple websites on a server or DMZ you should use a different anonymous user for each website to limit the potential scope of malicious activity.
That’s true. This is a development server and not Internet accessible, so it’s relatively safe, but giving write permissions to IUSR is probably bad advice in any circumstance.
Thanks, this solved my problem – appreciate the post!