2

I am not sure whether the git workflow I intend to create between my production and development server is the right way of doing it.

This is what i have in mind: Development takes place on local computers and commits are git push to development server. Once a stable release is available, the production server does a git pull from development server. Any unexpected results on production can be reverted with git revert

Is it the correct way of doing this? If so, how do I make existing code sitting on the development server, a remote repo? Presumably, it's remote to both production and local as they pull and push.

enter image description here

2 Answers 2

2

Is it the correct way of doing this?

Yes, that sounds completely reasonable.

If so, how do I make existing code sitting on the development server, a remote repo? Presumably, it's remote to both production and local as they pull and push.

Say you normally access your repo through ssh, like this:

brian@local$ ssh brian@development brian@development$ cd /home/brian/code brian@development$ git status 

Then you can clone this code with git clone ssh://brian@development:/home/brian/code. You should be able to git push and git pull to and from development from then on.

Sign up to request clarification or add additional context in comments.

Comments

1

Is it the correct way of doing this? If so, how do I make existing code sitting on the development server, a remote repo? Presumably, it's remote to both production and local as they pull and push.

Git is just a tool, there isn't any corrent way or how you use it makes it the correct way.

For your situation:

  • There are 3 server ( or says 3 git repo )
  • Local --push-to--> Development
  • Production <--pull-from-- Development

So you can build Development git repo first, then clone to Production and Local:

user@development $ setup_git_repo.sh user@local $ git clone ssh://user@development:/path/to/git/repo user@production $ git clone ssh://user@development:/path/to/git/repo 

Or you may clone via http:

user@development $ setup_git_repo.sh user@local $ git clone http://development.server/git/repo user@production $ git clone http://production.server/git/repo 

Then you have 3 git repo. Local git repo and production git repo are cloned from development git repo.

Finally, you may do daily coding in local and push to development. Do some test on development and release with new tag. Run git pull on production server to get the latest code.

1 Comment

Isn't the order of where you init a repository and where you clone it unimportant? You could git init --bare a repository on some server, and then clone it on production, staging and local server. Or am I misunderstanding your concepts? I think you mean a staging system/server with "development"?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.