We would like to use mercurial for web development, but we can't (and don't want to) install mercurial on a shared host. We try to use wget as mentioned here, but I get 401 error. Credentials and link are correct (modified for security).
Is there a way to download source from command line?
Is this bug or am i doing something wrong?
Response below:
$ wget _http://xxxx:yyyyyyy@bitbucket.org/username/repo/get/be51983f6357.zip
--2011-10-31 00:26:50--
http://username:password@bitbucket.org/username/repo/get/be51983f6357.zip
Resolving bitbucket.org... 207.223.240.182, 207.223.240.181
Connecting to bitbucket.org|207.223.240.182|:80... connected.
HTTP request sent, awaiting response...
301 Moved Permanently Location: https://bitbucket.org/username/repo/get/be51983f6357.zip [following]
--2011-10-31 00:26:51--
https://bitbucket.org/username/repo/get/get/be51983f6357.zip
Connecting to bitbucket.org|207.223.240.182|:443... connected.
HTTP request sent, awaiting response...
401 UNAUTHORIZED Authorization failed.
Take 2:
Thanx for help... i changed http to https and user user & password attributes:
Browser works fine, Wget does not...
$ wget --verbose --user=XXXXX --password=YYYY https://bitbucket.org/ekku/REPO/get/aabbccddeee.zip
--2011-10-31 18:27:10-- https://bitbucket.org/ekku/REPO/get/aabbccddeee.zip
Resolving bitbucket.org... 207.223.240.182, 207.223.240.181
Connecting to bitbucket.org|207.223.240.182|:443... connected.
HTTP request sent, awaiting response... 401 UNAUTHORIZED
Failed writing HTTP request: Bad file descriptor.
Retrying.
Take 3:
I also tried curl, but i get error message: Forbidden (403) CSRF verification failed. Request aborted.
You should not use bitbucket over
http
; always usehttps
. That should get rid of the additional redirect that you're seeing.Also use the command line options
--user
and--password
to specify the authentication forwget
; SSL probably doesn't allow to add user and password to the URL because the server part (between://
and the next/
) is sent to the server in plain text.I got it working with curl:
Answer from Bitbucket: Issue #3225 - Commanline download compressed tip