Download repository archives with repository access tokens

XMLWordPrintable

    • 2

      Problem Definition

      The archives on the Downloads page of the repo can be downloaded programmatically with basic authentication, as follows

      curl -u BB_Username:BB_AppPassword https://bitbucket.org/<workspace-id>/<repo-slug>/get/1.0.zip -o 1.0.zip

      However, this is not currently possible with a Repository access token. If someone is writing a script to download an archive, and that script can be accessed by other users as well, then their app password gets exposed to other users.

      Suggested Solution

      Support the download of repo archives using a Repository access token.

      Workaround

      A Git command can be used to clone the repo. If an archive of a certain tag or branch is needed, then the following command can be used to clone a specific tag or branch

      git clone --depth 1 --branch <branch_or_tag> https://x-token-auth@bitbucket.org/<workspace-id>/<repo-slug>.git

      <branch_or_tag> can be either a branch name or a tag name.
      --depth 1 is optional. If we only need the source code, then it may not be useful to clone the whole history.

      If only the source code files are needed and not the history, then the .git folder inside the repo can be deleted after the clone.

            Assignee:
            Unassigned
            Reporter:
            Theodora Boudale (Inactive)
            Votes:
            15 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated: