3

I wonder if anyone knows of a tool or method that I can use to accomplish my goal of having a folder that always contains a copy of the latest code from my Git repository.

I need it to work generically with Git, as it may be hosted on VisualStudio.com, Bitbucket, GitHub or any other Git provider.

Background: I have a requirement to keep all the latest code in a big data store in Azure. It will be hundreds of repositories, frequently adding more. I find it more scalable to download the code from a folder rather than integrating directly with Git with that many repositories. So I am looking for some existing method or tool to go in-between and place a copy of the latest code from my Git repository in a folder.

2 Answers 2

6

Use a Git post-receive hook to issue a git pull in the directory you want to keep updated. You might want to mount the directory you want to keep updated locally to the Git server, or execute that command remotely with ssh into Git Bash on Windows, or Powershell. Alternatively have the hook call a webhook and have the webhook execute the git pull. The webhook method will be easiest with BitBucket, I don't know about the others.

4

The standard pattern for this is to have a build that is triggered upon change to the git repository. The build will do nothing more than checkout the repository and make an archive of everything but the .git folder, then upload that to whatever file server(s) make(s) it available to all the things that need it. Implementation specifics depend on the git server, build server, file server, and build tool chosen but this should be trivial to implement in almost all cases.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.