views:

3969

answers:

4

I'm having problems with pushing to mercurial repository:

$ hg push
pushing to https://user:***@hg.domain.com/X_repo
searching for changes
abort: authorization failed

The same URL (with the same credentials) is accessible through the web browser. Also, I tried it without embedding usr+pass into the URL.

HTTPS is correctly configured, I tried both Basic and Digest auth -- without a luck.

Pulling (through HTTP) works fine.

I'm using hgwebdir to serve my repo.

What else should I check?

I found this: http://code.google.com/p/support/issues/detail?id=2580 In my case it's not random, it happens every single time.

Relevant part of my vhost conf:

  WSGIScriptAlias  /  /home/(...)/hgwebdir.wsgi

  <Directory /home/(...)>
    AuthType Basic
    AuthUserFile /(...)/basic-password
    AuthName (...)
    Require valid-user

    Order deny,allow
    Allow from all
  </Directory>

$ hg -v
Mercurial Distributed SCM (version 1.0.2)

Strangely enough hg outgoing works ok:

$ hg outgoing
comparing with https://hg.domain.com/X_repo
http authorization required
realm: ...
user: ...
password: 
searching for changes
changeset:   64:...
tag:         tip
user:        ...
date:        ...
summary:     ...
+2  A: 

It is strange that you can run hg outgoing but not hg push since it is my understanding that they both authenticate in the same way.

Unfortunately I'm not a hgweb expert. Please write the Mercurial list ([email protected]) and/or come online in IRC (#mercurial on irc.freenode.net). There will be many more people to help you there. IRC is especially good since these things are much easier to debug interactively.

Martin Geisler
Thanks for suggestions. I actually already tried IRC -- without a luck :/ I'll try with the mailing list.
piobyz
+7  A: 

Problem turned out to be repo dir permissions. chown www-data solved it...

piobyz
Don't forget that you also need allow_push in the [web] section of your .hg/hgrc
Frank Shearar
A: 

Just in case it might help someone - I encountered this error for unknown reasons, all permissions were OK, and just restarting apache solved it.

odd parity
A: 

If any body wants to make it run on local machine than adding this to server REPO/.hg/hgrc will do the work:

[web]
allow_push = *
push_ssl = false

as descibed at this site.

ssspiochld