0
votes

I am new with Git and would need some help. Working on Azure pipelines, I created few PowerShell scripts, hosted in an Azure files git repo. When the pipeline starts, on the Windows Self-hosted agent, I want a PowerShell script to download the latest version of the scripts in the git repo.

I tried:

E:
CD myFolder
git clone --no-checkout https://[email protected]/DefaultCollection/Project/_gits/fileRepos

But it only creates the _git folder and an empty structure

The fileRepos is structured like this: 
- fileRepos
  - Scripts
    - File 1
    - File 2

I don’t want to create a local repos or keep tracking of the files, I only want to download the files. In addition on my agent, I would want this structure:

e:\myFolder
  - Scripts
    - File 1
    - File 2

Could you please help me? Thanks

1

1 Answers

0
votes

How to git clone on Azure self hosted agent and powershell without creating a local repo

We could add a copy task in the pipeline to remove the fileRepos folder with following git clone command:

D:

cd myFolderTemp

git clone https://[email protected]/<YourOrganizationName>/<YourProject>/_git/TestSample

Then add copy task to copy the files from the temp folder myFolderTemp to myFolder without the .git folder:

enter image description here