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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T17:12:38+00:00 2026-05-31T17:12:38+00:00

What I want to do now is to initialize a private repository on my

  • 0

What I want to do now is to initialize a private repository on my production server in to app’s www folder (ex: /var/www/app.com/web/) and then clone it as a staging repository to my testing site (ex: /var/www/test.com/web/app.com/) and finaly clone from staging to local to work with the code.

Am I planning it the right way?

I am following these tutorials to learn more about setting the “git server” and initialize private repositories:

  • http://progit.org/book/ch4-4.html
  • https://moocode.com/posts/6-code-your-own-multi-user-private-git-server-in-5-minutes
  • http://www.layeredthoughts.com/git/private-remote-git-repositories-ubuntu-linode

One last question, this tutorial about A Successful Git Branching Model where would apply? On the main private repository (production server), local, or mixed? I haven’t read it completely yet, I’ll do it asap.

EDIT:

  • If it matters, I am trying to do so on a server running ISPConfig configuration.
  • It’s not a must to work/be as mentioned above, if there is a “healthier” way… glad to learn about it.

This http://www.howtoforge.com/the-perfect-subversion-server-debian-lenny-ispconfig-3 and this http://www.howtoforge.com/installing-subversion-and-configuring-access-through-different-protocols-on-ubuntu-11.10 to GIT version is what I kinda had in mind

  • 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-31T17:12:39+00:00Added an answer on May 31, 2026 at 5:12 pm

    Am I planning it the right way?

    The cascading repos sounds quite complex, and is not normal.

    Consider any checkout a client/satelite/child of the bare git repo you are committing to. Your staging and production installs should be read-only checkouts of specific branches, you are perhaps already familiar (because almost all git questions get a link to it – this question now being no exception) with git-flow which may give some insight into how to setup your branches and therefore checkouts appropriately.

    Git Server Setup

    This tutorial is probably the only one you need to follow.

    Note that if you setup the git user with a home at /home/git and create a repo at /home/git/project.git that means you don’t need absolute paths. I.e.

    (server) $ cd /home/git
    (server) $ mkdir project.git
    (server) $ cd project.git
    (server) $ git --bare init
    

    Then wherever you want it:

    (home) $ git clone git@server:project.git
    

    of course, you could also put your git repos wherever you want and just change the git user’s home dir (in /etc/passwd) to achieve the same.

    Update on push

    If you want to update a checkout whenever you push to a repository, you need a post-receive hook to do it. First set your self up correctly:

    (server) $ cd /var/www/app.com/web/
    (server) $ git clone -b production-branch /home/git/project.git . # it's local - use a file path
    (server) $ cd /var/www/test.com/web/app.com/
    (server) $ git clone -b staging-branch /home/git/project.git .
    

    Then create /home/git/project.git/hooks/post-update with

    cd /var/www/test.com/web/app.com
    git --git-dir /var/www/test.com/web/app.com/.git pull #> /dev/null 2>&1 & #uncomment after testing
    

    Ensure that:

    • The hook file is executable and owned by git
    • Git is (also) in the same group as the owner of the checked out files otherwise you’ll get permission errors when you push

    As written above the output of the command will be sent to you every time you push, which will make pushing slow(ish). You can run it in the background when you’re sure it works correctly. It won’t matter that staging checkout is pulling on every push – if there’s no changes to the branch it’s pointing at, it won’t do anything.

    It’s probably not a good idea to update your live site automatically. Instead

    (home) $ git checkout production-branch
    (home) $ git merge staging-branch
    (home) $ git push # updating production-branch
    (home) $ git checkout feature/i-was-working-on-this
    (home) $ ssh server 'cd /var/www/app.com/web/; git pull'
    # Manual Post update checks
    

    If you did that automatically and for example the update left your production site in an unusable state – you may not know (until/unless you get a pingdom alert saying “Production site offline”). It would be safe to automate updating your live site if you’ve got significant test coverage and an automated deploy process – but walk before running :).

    Direct push

    You can if you really want to push into a not-bare checkout if you set

    [receive]
        denyCurrentBranch = ignore
    

    In the project’s .git/config file, if there are no local changes that should also update the working copy (iirc).

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

Sidebar

Related Questions

I have till now mainly concentrated on web programming thus far and now want
I want to create an authorization filter for my web app(To be able to
In this following gridview image.png images are taken from the drawable folder.Now I want
I have build my very first application to Android and I want now to
a few minutes ago I had a discussion with my boss and want now
I want to now how do i split a string like 44664212666666 into [44664212
i want to reload ViewdidLoad in a method But now want to call again
I collected some CompiledMethods in an Array and now want to review them manually
I'm receiving an xml response and I now want to parse this. Currently what
I am currently coding some chat program and now want to play music via

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.