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 6075157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:27:46+00:00 2026-05-23T10:27:46+00:00

On one server I work on, we must log in as root (for reasons

  • 0

On one server I work on, we must log in as root (for reasons I won’t get into here). We have a git repository set up which is used for the web server, but since files are created as root, files modified by git have the wrong permissions.

I created an incredibly simple post-merge hook which I thought would solve the problem.

#!/bin/bash
. git-sh-setup
chown -R www-data:www-data $GIT_DIR

I dropped this into .git/hooks/post-merge with execute permissions, but the file never seems to run. This is the first time I’ve tried to set up a hook, so maybe I’m missing something obvious.

One thing I did notice is that most hooks had a .sample file, while post-merge did not. (git version 1.7.4)

Thanks in advance!

  • 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-23T10:27:47+00:00Added an answer on May 23, 2026 at 10:27 am

    You might have already known but you might want to check for the EOL characters (CRs) in your post-merge hook. This might explain why your hook doesn’t execute (as mentioned in this other question git-hook-post-merge-error-cannot-run.

    If this isn’t the solution you could also possibly look at another approach for your problem. You could make a task to perform the owner changes to your directory when a file in your repository change on the server. Cron tasks on their own do not react based on filesystem changes, but you could take a stab at using something like inotify to react to changes in the server’s git repository on any changes.

    I hope that these two pieces of information either solve your problem or at least puts you closer. Good luck.

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

Sidebar

Related Questions

In Team Foundation Server is there a way to have work items in one
I have migrated Project server from one server to another. I am able to
I'd like to have one server make an http post request to another server.
I have a few SQL Server databases (all in one server), containing their own
Currently I'm developing a spatial data processing server. Here are requirements: Server must be
Trying to set up one-way SSL with Weblogic 11g and running into an issue.
I have a iPhone app that must work offline, and need be able to
I have a modular software, one module must be a webserver that accept REST
I must be doing some stupid mistake. I have a server that returns the
I will work with one designer that does not know anything of Git. I

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.