Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7630193
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T06:02:24+00:00 2026-05-31T06:02:24+00:00

I have a bare repo that receives only pushes. When such pushes are made,

  • 0

I have a bare repo that receives only pushes. When such pushes are made, I’d like for those changes to be reflected by the bare repo to another location (not a clone, just a static location with no .git folder).

Is this possible?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T06:02:25+00:00Added an answer on May 31, 2026 at 6:02 am

    Sure. In order to do some action whenever someone pushes, create a post-receive hook. In order to get those changes from a bare repository into another directory (which is not a Git repository), you will need to create a git archive and expand it in the location that you want to update.

    The post-receive hook receives on standard input a list of all refs that have been updated by a push as well as their old and new values, in the following format (where SP is a space character, <old-value> and <new-value> are revisions, and <ref-name> is the ref that was updated):

    <old-value> SP <new-value> SP <ref-name>
    

    If you’re only interested in mirroring master into your destination directory, you’ll want to only execute your script if you see such a line.

    For example, something like this would probably work (untested, so test this out on a location you don’t care about before trusting it):

    #!/bin/sh
    while read old new ref; do
        if [ "$ref" = master ]; then
          git archive master | tar -x -C /path/to/expand/into
        fi
    done
    

    edit: Note that this has a fairly serious drawback; if you delete (or move) a file, this won’t delete that file in the destination directory. One potential solution would be to add an rm -rf /path/to/expand/into; mkdir /path/to/expand/into before the archive line.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a central Git bare repository. When a push is made to that
I have a server that is hosting my 'bare' GIT repo for a few
I have local repository, and a remote bare repository. I've made changes to my
I have created a bare git repo (lets call it repo #1) and cloned
I have a bare-bones install of jenkins on my Ubuntu server that I installed
I have a bare repository that's used as the central store for my project.
I have an existing git repo (a bare one) which has up to this
I have a bare repo server-side, and I am able to successfully commit and
I have a CENTRAL bare repository that has three developer repositories pulling and pushing
I want to update a bare repo, and have it do something after something

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.