Forum Discussion

grsm001's avatar
grsm001
Copper Contributor
Jul 02, 2020
Solved

Trying to down just specific file in Azure repo to Windows and Linux.

I am new to Azure and created a text file to test with in my Azure repo. I have the command "git" on Windows to download from the Windows server and "wget" or "curl" on Linux. Could somebody give me ...
  • grsm001's avatar
    grsm001
    Jul 10, 2020

    I was able to find a solution per this thread: https://stackoverflow.com/questions/2466735/how-to-sparsely-checkout-only-one-single-file-from-a-git-repository/19501643#19501643 - using the -n parameter clone the branch without downloading anything then using the "checkout"  command with "HEAD", you can download a single file.

     

    git clone -n -b <branch> <path to master> --depth 1

    cd <repo>

    git checkout HEAD <file in branch>

     

    For example: download "test.txt"  file from the "scripts" branch of the repo "WebSphere"

     

    >git clone -n -b scripts https://<*.com>/_git/WebSphere --depth 1

     

    >cd WebSphere

     

    >git checkout HEAD test.txt

     

Resources