Overthought: Set Up Dev/Staging/Production Repositories Using Git
Overthought: Set Up Dev/Staging/Production Repositories Using Git
Overthought
Home
About Me
Resume
Projects
pdfcrowd.com
means you have to configure ssh for that and add your public key from wherever you are going to be pushing
data to your server into the authorized_keys file. Take the time to ssh [email protected] to see if it worked.
Issue you may face: The .ssh folder and authorized_keys file needs to be given certain permissions. sudo
chmod 0700 on the .ssh folder and sudo chmod 0600 on authorized_keys file. If authorized_keys is a directory
for some reason, rename the folder to something else and change the name of the file inside of it to authorized
keys and move it out of that folder into the .ssh folder. Make sure you chmod it or else ssh will not authenticate!
3. You want to run git init in a project directory on your server. If you have a linux group like I do, then add
shared=group and use chgrp groupname ./reponame to change the group owner to your group. You may need
to give write permission to the group.
4. Now you want to run git add . to add all of the files and then git commit m First commit!. This should have
created the master branch.
5. Lets create a staging branch with git checkout b staging. Now we should be in the staging branch. To go
back to master, do git checkout master.
6. You can either create a staging directory somewhere or go to your staging server and do git clone
[email protected]:projectname.git b staging. Now you should have the staging branch only. Check with git
branch.
7. Then you want to create a symlink to the .git folder in your staging project directory. ln s
/folder/to/staging_project/.git/ ~/home/git-user/projectname.git
Here you are creating a link to your staging directory because in the next steps you will be cloning from this and
open in browser PRO version
pdfcrowd.com
pushing to this area. I guess it would be more of a step 6.1 if that makes the relation clear.
8. Depending on what you did, if you have a staging server, you may have to do all of that user/ssh stuff again if
you have not already. I will assume you have a staging directory on the same server as the production. Create
a dev branch in the staging area.
9. Do git clone of the dev branch onto your development machine (remember the directory from step 7?). You
should be able to make changes, add, commit, and push.
10. Now wed like to push changes to the staging. Once you have a dev branch in your staging area, you can
easily push upstream, since your staging area will always be on the staging branch. Once changes are pushed
to the dev branch from your dev machine, you can do git merge dev to get changes from the dev branch.
11. To update the general repositorys staging branch, do git push u. This should update your staging area.
12. Okay, good lets push up the changes to master. Same process from step 10, except we replace dev with
staging.
Hopefully, this works. Any errors? Just email me and Ill try to help.
You just read Set Up Dev/Staging/Production Repositories using Git. Please share if you've liked it.
You may find related posts by clicking on the tags and/or categories above.
Norman's Oven 2014
pdfcrowd.com