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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T00:59:39+00:00 2026-06-10T00:59:39+00:00

I have a git repo on my EC2 Amazon Linux Development server. i am

  • 0

I have a git repo on my EC2 Amazon Linux Development server. i am using SSH to push changes from my local git repo on my laptop.

i have confirmed that the push is working correctly as the contents of my local repo are mirrored on the Dev server. however it appears that my post-receive hook is not firing. as code is not getting checked out to my html directory.

i have even attempted putting an echo command to at least confirm that the hook was firing but there is no feedback in the command line except for on the local end the results of the push.

#!/bin/sh
#
# An example hook script for the "post-receive" event.
#
# The "post-receive" script is run after receive-pack has accepted a pack
# and the repository has been updated.  It is passed arguments in through
# stdin in the form
#  <oldrev> <newrev> <refname>
# For example:
#  aa453216d1b3e49e7f6f98441fa56946ddcd6a20 68f7abf4e6f922807889f52bc043ecd31b7$
#
# see contrib/hooks/ for a sample, or uncomment the next line and
# rename the file to "post-receive".

#. /usr/share/git-core/contrib/hooks/post-receive-email
GIT_WORK_TREE=/var/www/html sudo git checkout -f
  • 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-06-10T00:59:40+00:00Added an answer on June 10, 2026 at 12:59 am

    sudo is likely not preserving the GIT_WORK_TREE environment variable – it is quite often configured to provide a sanitized environment for the commands that it runs, especially when they run as root. git has some command line arguments (--git-dir and --work-tree specifically) that accomplish the same thing that the environment variable is intended to. You’ll probably need to use those in this case.

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

Sidebar

Related Questions

I'd like to have git automatically push local changes to the upstream subversion repo
I have a git clone/repo on a development server, but I am now moving
I have a Git repo that I have deleted four files from using rm
I have a local git repo cloned from bitbucket.com I do a lot of
I have a local Git repo that I would like to push to a
I have a git repo hosted on my server using gitosis. I had branches
So if I have a Git repo on my local machine and I send
I have a local git repo, and I have a remote git repo. What
I have a git repo I've been using for the last year on the
we have a git svn repo that fetches from svn and shows all the

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.