Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mercurial push, abort: authorization failed

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:     ...
like image 860
Piotr Byzia Avatar asked Jun 03 '09 19:06

Piotr Byzia


3 Answers

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

[web]
allow_push = *
push_ssl = false

as described at this site.

like image 97
lukmdo Avatar answered Nov 19 '22 11:11

lukmdo


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

like image 21
Piotr Byzia Avatar answered Nov 19 '22 11:11

Piotr Byzia


For those with TortoiseHg pushing to a web server (another unauthorized user on another PC):

In TortoiseHg: File - Settings - (Either globally or just for the current repository - tabs) then the Server settings. Web Server

Push Requires SSL - No
Allow Push - *

This does the same thing through the UI as lukmdo's answer above (editing the hgrc file).

like image 3
lko Avatar answered Nov 19 '22 11:11

lko