wget returns a 404 error when downloading a repo's archive from the Downloads page

Platform Notice: Cloud Only - This article only applies to Atlassian products on the cloud platform.

Problem

You use a command like the following to download an archive of a Bitbucket Cloud repo from the Downloads page:

1 wget --user=username --ask-password https://bitbucket.org/workspace-id/repo/get/master.tar.gz 

where

username: your Bitbucket username, which can be found here: https://bitbucket.org/account/settings/

workspace-id: the ID of the workspace where the repo belongs. For example, if your repo's URL is https://bitbucket.org/workspace-id/repo, then workspace-id is the ID of the workspace

repo: the repo slug. For example, if your repo's URL is https://bitbucket.org/workspace-id/repo, then repo is the repo slug

master: this could be the name of a different branch or the commit hash of one of the repo's commits

Wget returns the following error:

1 2 3 4 5 --2023-12-15 15:14:36--  https://bitbucket.org/workspace-id/repo/get/master.tar.gz Resolving bitbucket.org (bitbucket.org)... 104.192.141.1 Connecting to bitbucket.org (bitbucket.org)|104.192.141.1|:443... connected. HTTP request sent, awaiting response... 404 Not Found 2023-12-15 15:14:36 ERROR 404: Not Found.

Cause

The wget command always waits for the 403 challenge from the server before it sends the credentials to the server. However, Bitbucket Cloud servers initially send a 404 status to the client, and as a result, wget doesn't send credentials later on.

Solution

First solution

Use the --auth-no-challenge flag in the wget command as follows:

1 wget --auth-no-challenge --user=username --ask-password https://bitbucket.org/workspace-id/repo/get/master.tar.gz 

When you get asked for a password, please ensure you are using an app password for your account, with at least Repositories: Read permissions, and not your account's password.

Otherwise, you will get a 401 error because we have deprecated the use of Atlassian account passwords for Git and Bitbucket API activity.

Second solution

Use curl to download the repo archive:

1 curl -u username:apppassword https://bitbucket.org/workspace-id/repo/get/master.tar.gz -o master.tar.gz

Reference: How to download repositories archive using CLI

Updated on April 15, 2025

Still need help?

The Atlassian Community is here for you.