How to download specific files from a Bitbucket repository
Platform Notice: Cloud Only - This article only applies to Atlassian products on the cloud platform.
Summary
This guide provides step-by-step instructions on how to download files from a Bitbucket cloud repository using either the Bitbucket Cloud UI or the API v2.0 endpoint.
Solutions
Option 1 - Download the file via the UI
- Navigate to the file(s) in the Bitbucket Cloud Repository UI by clicking on the Source tab.
- Open the files you want to download.
- On the right-hand side, click the ... button.
- Select Open Raw.
Opening the file in Raw will automatically download it. If you want to download code/text or anything other than binary files, you'll need to manually save it right-clicking and using your browser's "Save As" option.
Option 2 - Download the file via the cURL utility
Before proceeding, ensure you have the following prerequisites: Workspace ID, Repository URL, Branch Name, and App password.
Follow these steps:
- Locate the files you want to download in the Bitbucket Cloud repository from the Source tab.
- Use the following example cURL command to download the file:
curl -s -S --user <username>:<App Password> -L -O https://api.bitbucket.org/2.0/repositories/<WorkspaceID>/<RepoName>/src/<BranchName>/<FolderName>/<FileName>
Replace the placeholders in the command with your specific information:
- <Username>: Your username
- <App Password>: Your generated App Password
<WorkspaceID>
: Your Workspace name.<RepoName>
: Your Repository name.<BranchName>
: The Branch name.<FolderName>
: If the file is in a folder, provide the folder name.<FileName>
: The file's name, including the file extension, for example:(example.txt
).
If the above instructions do not assist you with downloading files from your repository, please raise a support ticket or raise a community support ticket for further assistance with this.