Download source locally from Azure Devops GIT repository
We have recently moved our source code from a local TFS repository to an Azure Devops Git repository.
For now we are going to continue building locally, so I need a script to download the latest version of a branch locally, before building.
I have tried a few different methods, but am getting confused about the best one to go with:
Git Bash
- I have installed Git Bash, and have managed to clone a branch successfully via the interface.
- I have looked at scripting Git requests in Powershell, but am struggling with scripting the authentication prior to Git requests.
- I'm also a bit unsure of the steps required to 'Get Latest' in Powershell prior to each build. I'm thinking the steps should be something like:
- Authenticate into repository.
- Change directory to the directory you want to download to (Get Latest into).
- Execute the Git clone command for a branch if it has not been cloned yet (how do you check this?)
- Execute the Git pull command for a branch if it has been cloned.
Azure Devops REST APIs
I have also investigated Azure Devops REST API Git repository requests. I have managed to execute a repositories request.
Is it possible to download a branch with the REST apis, or are they just for requesting information about the repositories?
Thanks.
Posted Oct 18, 2019, 4:27 AM UTC
Why not just install the AzD agent on a local VM and use the pipeline task preconfigured to dl files from the AzD git repo you configure the pipeline to work with?
Also if you want to talk to AzD API using PS, have a look at this:
https://github.com/DarqueWarrior/vsteam
Agreed with above. Use the tools from the box.