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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T14:12:35+00:00 2026-06-01T14:12:35+00:00

i would like to setup auto deployment script to my testing server locally. i’m

  • 0

i would like to setup auto deployment script to my testing server locally.
i’m using gitolite on ubuntu desktop 11.04.
i install gitolite using apt-get install gitolite, so it is create user gitolite and group gitolite.
Now i setup my testing webserver using apache which has user and group ivan:ivan,
and do git clone under that username.
so all the files and folder have the same file owner ivan:ivan.

i setup post-receive hooks under /var/lib/gitolite/repository/testrepo/hooks/ and have this script inside:

#!/bin/bash
#CONFIG
LIVE="/home/ivan/public_html/testrepo"

read oldrev newrev refname
if [ $refname = "refs/heads/master" ]; then
  echo "===== DEPLOYING TO TEST SITE ====="
  unset GIT_DIR
  cd $LIVE
  git pull origin master:
  echo "===== DONE ====="
fi  

Since post-receive hooks is executed by gitolite user, it has permission problem to access to the test server which is using user ivan.

i already add gitolite to ivan group and make it group access write, but still it cannot run.
i know this is a permission problem, but i don’t know the solution.
If you have same experience or got any tips, i would really appreciate it.

Thanks
Ivan

  • 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-01T14:12:36+00:00Added an answer on June 1, 2026 at 2:12 pm

    I finally got the solution on my own, thanks for VonC for the pointers.
    My solution may not beauty but yet work.

    So here are the steps that work in my solution:

    1. I create a bare repositories which will have the same user permission with the web application.

    2. In Gitolite Repositories folder (in Ubuntu: /var/lib/gitolite/repositories), i create a post-receive hook which will mirror the the repository the bare repo that i just created. Code is:

      #!/bin/bash
      echo '==== DO MIRROR ===='
      git push --mirror user@host:path/to/bare.git
      echo '==== DONE MIRROR ===='

    3. And in my web application, i will create a remote that connect to that bare repo.

    4. Then i create a post-receive hook in the mirrored bare repo, that will ask the web application to pull from it. The code:

      #!/bin/bash
      WORK_DIR="/home/ivan/public_html/test/testing"
      read oldrev newrev refname
      if [ $refname = "refs/heads/master" ]; then
      echo "===== DEPLOYING TO LIVE SITE ====="
      unset GIT_DIR
      cd $WORK_DIR
      git pull mirror-repo master
      echo "===== DONE ====="
      fi

    5. Don’t forget to chmod +x for both post-receive.

    As i said before, it may not beautiful but yet work, at least for my current situation. The reason why i’m not just pull it from the gitolite repositories is because of user file permissions. In Ubuntu (install from apt-get), gitolite hold user and group, gitolite:gitolite. and my web application is under my home folder (i’m using suPHP) which have user and group ivan:ivan.
    So when i pushed to the gitolite repositories, it will run the bash script under gitolite user, which cannot access the .git folder under my home folder.

    So yes, for those who have better solutions, i’m eager to hear from you.
    Thanks hope my solution may help others.
    Ivan

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

Sidebar

Related Questions

I would like to setup some automated testing of test cases upon Fortran binaries
I would like to install my setup content only to one specific directory, so
I would like to reliably auto-install my application assemblies in the GAC when I
I would like to setup a admin page (ASP.NET/C#) that can add IIS host
I would like to setup TinyMCE to allow literally any HTML without any cleaning
I would like to setup a multi-tenant ASP.NET MVC app. Ideally, this app would
I would like to setup my maven release to run in batch mode, but
I would like to setup a simple loginpage for my webapp. As the app
Is there a Bayesian filter library for .NET? I would like to setup a
I would like to learn how setup prefix routing like there is in cakephp

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.