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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:01:55+00:00 2026-05-27T02:01:55+00:00

I am using git to manage a dynamic website (PHP + MySQL) and I

  • 0

I am using git to manage a dynamic website (PHP + MySQL) and I want to send my files from my localhost to my staging and development servers in the most efficient and hassle-free way.

I am currently convinced that the best way for me to approach this problem is to use this git branching model to organize my local git repo. From there, I will use the release branches to push to my staging server for testing. Once I am happy that the release code works on the staging server, I can then merge with my master branch and push that to my production server.

Pushing to Staging Server:

As noted in many introductory git posts, I could run into problems pushing into a non-bare repo, so, as suggested in this response, I plan to push the release branch to a bare repo on the server and have a post-receive hook that clones the bare repo to a non-bare repo that also acts as the web-hosted directory.

Pushing to Production Server:

Here’s my newest source of confusion…

In the response that I cited above, it made me curious as to why @Paul states that it’s a completely different story when pushing to a live, development server. I guess I don’t see the problem. Would it be safe and hassle-free to follow the same steps as above, but for the master branch? Where are the potential pit-falls?

Config Files:

With respect to configuration files that are unique to each environment (.htaccess, config.php, etc), it seems simplest to .gitignore each of those files in their respective repos on their respective servers. Can you see anything immediately wrong with this? Better solutions?

Accessing Data:

Finally, as I initially stated, the site uses MySQL databases to store data. How would you suggest I access that data (for testing purposes) from the staging server and localhost?

I realize that I may have asked way too many questions for a single post, but since they’re all related to the best way to set up this development scheme, I thought it was necessary.

  • 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-27T02:01:56+00:00Added an answer on May 27, 2026 at 2:01 am

    Pushing to the production server

    I assume that in the response you quote, the answer refers to pushing to the production server as “a different story”, just because one can push any old commit to the staging server for testing, but you would be very careful only to push a thoroughly tested version to the production server.

    I think the approach you refer to (of deploying by pushing to a bare repository with a post-receive that does git checkout -f with an appropriately set GIT_WORK_TREE) is a good one for deploying from git.

    Config Files

    That is a reasonable plan, but you have to be a somewhat careful about using .gitignore to ignore configuration files – you might want to look at this answer for more about this:

    • How can I have different versions of a file in the local working directory, remote working directory and git ftp target?

    Accessing data

    I think the question about data for your staging server really is a separate issue, since none of that data will be in your version control system – it might be worth adding another question here about that issue. You could have a script that dumps data on your live server and imports it to the staging server, but I can think of many situations in which that would be undesirable, particularly where customer details and data protections laws have to be considered.

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

Sidebar

Related Questions

I'm using Git to manage my two computers and my development. I'm trying to
I'm using git to manage files in a local directory on a Windows machine
I'm using Git to manage my website's source code and deployment, and currently have
I'm using git to manage a tiny project. I've been performing all of my
I am using git for windows to manage a local project. I have two
I am using git on a project, that generates lots of data-files (simulation-results). I
I'm using git for a PHP project, I think it's really handy. There is
I'm using git to manage an extended CodeIgniter Framework. It's a clone of the
We have a website using Rails 2.3.x, bundler, nginx, passenger and git, and would
I'm using windows powershell to manage git, but am limited in that it can't

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.