Search code examples
gitazurearchive

Running "git archive" in Azure Git gives error message


I am trying to pull a single file from an Azure Git repo.

But if I run this: git archive --remote="ssh.dev.azure.com:v3/[organization]/[project]/[repo]" master myfile

It returns an error:

remote: Could not find a Command Extension for Command:git-upload-archive
fatal: the remote end hung up unexpectedly

This happens in both Linux and Windows.

On the other hand, note that these work fine:

git clone "ssh.dev.azure.com:v3/[organization]/[project]/[repo]"

git ls-remote "ssh.dev.azure.com:v3/[organization]/[project]/[repo]"


Solution

  • I was able to pull data from a file with this method:

    curl -u ":[Personal Access Token]" "https://dev.azure.com/[organization]/[project]/_apis/sourceProviders/TfsGit/filecontents?repository=[repo]&path=[filepath]&commitOrBranch=[branch]&api-version=5.0-preview.1"