Mercurial: Why do I get a 404 error when pushing to a repository whose URL I can hit in a browser?

16,398

Solution 1

Is this similar to this configuration, where hgweb.config need to be configured properly:

/ = /home/my_username/hg/**

(with the two stars at then end)

Or is it a http vs. https issue?

For https, you need a correct .hgrc file, otherwise you can also get the 404 error.
See the .hg/hgrc file man page.

[ui]

username = [email protected]

password = mypassword

schemes = https

[paths]

default = https://myURL.kilnhg.com/Repo/Repositories/Groups/myrepo

Solution 2

"content too large" is what I had. Go to the IIS logs and look for "404 13".

To fix it, under IIS manager, go the the "Request Filtering" option, and then select the "Headers" tab.

Then go to "Edit Feature Settings" on the right. Then pick a really big number for the "Maximum allowed content (Bytes)" field.

This fixed my issue.

Solution 3

We suddenly started getting this error on our main Mercurial repository, hosted under IIS on Windows 2008. When your repository has too many heads, Mercurial POSTs query strings longer than IIS chooses to handle.

You can tell by looking at the sub-status code of the failed request in the IIS logs (it's usually the number after the normal HTTP status code). In this situation, IIS returns a sub-status of 15 which means the query string is too long. Don't forget to check your sub-status codes!

To fix the issue, you'll need to increase IIS's maxiumum query string length:

 # Get the current query string size limit
 c:\windows\system32\inetsrv\appcmd list config /section:requestFiltering -text:requestLimits.maxQueryString

 # Set the new query string size limit
 c:\windows\system32\inetsrv\appcmd set config /section:requestFiltering /requestLimits.maxQueryString:<NEW SIZE>

Solution 4

I had the same problem and it ended up being the VERBs allowed for the CGI handler. I had limited it to GET, POST and HEAD, but ended up changing it to allow all and it works fine now.

Solution 5

I received this error while trying to push a lot of changesets, with an especially large-sized one with many binary files (jpg update on a website). [jpg under source control, in the same repo as the source might not be the best approach, but that's besides the point.]

In such a case, if you don't have access to the IIS configuration, a work-around is to push fewer changesets at a time. In TortoiseHg, use the Outgoing feature, right-click the top changeset of the subset you want to push, and select Push To Here. Repeat.

Share:
16,398
Mike Pateras
Author by

Mike Pateras

Young developer, interested in gaming and game development, along with many other things.

Updated on June 05, 2022

Comments

  • Mike Pateras
    Mike Pateras about 2 years

    I have a Mercurial repository that I can see just fine if I navigate to it in a browser, but when I try to do a push, with my default path set to the same URL that I visit in the browser, I get this:

    abort: HTTP Error 404: Not Found
    

    Should the URL that I push to be different in some way?

  • Mike Pateras
    Mike Pateras over 14 years
    It wasn't the second, as trying that didn't seem to help. Where should I have a hgweb.config file? I couldn't seem to find where that file should exist in Windows (7).
  • VonC
    VonC over 14 years
    @Mike: the hgweb.config would be on the server side: if you don't have access to it, we can only assume it is correct, and that your access credential/schema are somehow faulty.
  • Mike Pateras
    Mike Pateras over 14 years
    I don't know if it was that, specifically, but it was definitely some server side setting.
  • redsquare
    redsquare over 12 years
    Nice, this confused me for a few hours
  • Ian Kemp
    Ian Kemp over 12 years
    We had this exact problem and your answer fixed it, many thanks! For those who may be having trouble determining if this is happening to them - search for the string "404 15" in your IIS logs, if you find it after a LONG querystring then this answer should help you too.
  • Erica
    Erica almost 7 years
    First link forum.webfaction.com/viewtopic.php?id=3558 is now broken.
  • VonC
    VonC almost 7 years
    @Erica Thank you. i have replaced that old link by a link to a similar question (but less precise than he old one though)