How to integrate Git in Development and Production Servers

Hi everyone,

I’ve been thinking how to integrate git in our workplace setup. Just to give a background in our workplace environment, we have Production Server [dedicated server with domain] and Development Server [dedicated server, public ip], both store source codes that are not identical to each other. There are only two of us who maintain the website and we access the source code using filezilla FTP. We manually save a backup copy of codes to be edited every update we made on feature or bugs. Currently, the way we handle bug/fixes and features are like this:

  1. Download latest copy of source code from Filezilla connected to dev server.

  2. Work on some codes.

  3. Upload file back to dev server.

  4. Test the updated code on dev server site [we dont have any local testing on our own pc].

  5. If the update is fine and working as expected, we connect to dev server via remote desktop.

  6. Upload the file from dev server to prod server.

I’ve been using git only on my local working directory for a month, simply to trace the updates i’ve made and branch off features. Once I’ve done coding, I upload the file via filezilla, test it in dev server site. Upon acceptance of user, that is the only time I commit the changes on my local repo. I find it beneficial on my part as I dont need to log every file that I have changed, as git do it for me. I can simply switch back and forth from previous version of source code without the need to save a physical backup copy of pre-edited code.

With that, I want to introduce it to my team as I’m the only one who uses git on my local working directory. My co developer is optimistic with it and wanted it to be part of our standard operation procedure.

Now the question is how can we use git in our existing environment, knowing that our starting PROD [holds stable version], DEV [holds unpublished features]  and local working directory [might hold unpublish feature not on dev] are different.

Where should we start? what server will be the initial repo? Do we need to have a local testing before pushing to development server?

If anyone could give a suggestion to setup our servers with git would  be a great help. Thank you in advance.

Hi @markuscorvinus,

Thanks for this feedback! We’re always working to improve GitHub and the GitHub Community Forum, and we consider every suggestion we receive. I’ve logged your feature request in our internal feature request list. Though I can’t guarantee anything or share a timeline for this, I can tell you that it’s been shared with the appropriate teams for consideration.

Cheers!

1 Like

Hi @markuscorvinus !

Thank you for sharing the background on your current approach and your goals!  

If you haven’t already seen these threads in the community: [How to structure git for production and development webserver environment?], [Git Branch Structure: Development, Testing and Production], [New to github - I need some help], and [Automatic pull from the specific branch to my development environment server], they contain some discussion and suggestions on how others configure the workflow between production, development and local environments.  Perhaps the users on those threads may be able to offer additional feedback for your objective.

I have also seen that some developers use git remote in order to Add a New Remote for the additional environments and subsequently:

  • push to each repository separately,
  • push to multiple repositories at once,
  • or utilize an automated approach (such as a shell script) to push to, or to sync both the development and production environments after local changes.
1 Like