question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Accessing Git repo

See original GitHub issue

This is maybe not directly on issue with the tasks but more with the agent. What is the recommended approach to run Git operation during a build?

My use case is that I have a repository utilizing git-lfs. Since VSTS only does a checkout I manually need to call git lfs fetch afterwards. The problem here is the authentication. I want to avoid to have to setup an service account for accessing the repo just for this case. The agent already somehow manages to checkout the repo. Is it possible to use the same approach for additional operations?

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:17 (15 by maintainers)

github_iconTop GitHub Comments

1reaction
fahnzmodecommented, Oct 2, 2017

@ericsciple - would you happen to have any additional info on the possibility of VSTS builds being able to checkout multiple git repositories? Would be very nice to have first-class support for this.

Dave Burnison mentions the steps needed to cleanly clone the git repo yourself:

  1. Use a PowerShell task to call a script that: – Changes directories to the $(build.sourcesDirectory) – Creates a new folder called “Build” under $(build.sourcesDirectory) – Changes directories to the $(build.sourcesDirectory)\Build – Calls “git init” – Calls “git clone https://VSTSAccountName.visualstudio.com/SomeCollection/Build/_git/BuildUtilsStoredInGit” where the URL points to a Git repository that has a set of scripts that are similar to $/Build/PSScripts in the blog post.
  2. Use additional PowerShell tasks to execute the script(s) as needed from $(build.sourcesDirectory)\Build (e.g. $(build.sourcesDirectory)\Build\PSScripts\ApplyVersionToAssemblies.ps1 )
  3. At the end of your build process add a command line task to call the following command which will remove the local copy of the Git repository – RmDir /S /Q “$(build.sourcesDirectory)\Build”

(see his ‘June 1, 2016 at 8:22 pm’ comment here: https://blogs.msdn.microsoft.com/premier_developer/2016/04/13/tips-for-writing-powershell-scripts-to-use-in-build-and-release-tasks/)

0reactions
ericsciplecommented, Oct 2, 2017

It’s something we want to do for multiple reasons. It’s not next though.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting a Git Repository - Git SCM
Getting Git on a Server will introduce all of the available options the server can set up to access your Git repository and...
Read more >
Git on the command line - GitLab Docs
Introduction to using Git through the command line.
Read more >
How to access a Git repo? - SiteGround KB
The Git repo created by the Git tool is created in the home folder of your site. It is named .git. To clone...
Read more >
How to connect to a remote Git repository? - Stack Overflow
Right click the folder "MY_GIT_REPOSITORY" and select "Sharing". This will give you the ability to share your git repository as a network ...
Read more >
About remote repositories - GitHub Docs
When you git clone , git fetch , git pull , or git push to a remote repository using HTTPS URLs on the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found