HiveBrain v1.2.0
Get Started
← Back to all entries
patterngitMinor

Need a folder, always updated with the latest code from Git

Submitted by: @import:stackexchange-devops··
0
Viewed 0 times
thelatestneedwithalwaysfoldergitupdatedcodefrom

Problem

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.

Solution

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.

Context

StackExchange DevOps Q#2414, answer score: 6

Revisions (0)

No revisions yet.