cg is a simple tool that helps to keep machine configuration in git repository.
Create cg group, and add your trusted users to this group.
cg group will have full access to configuration files in cg repository. Remeber that only root has full access to $GIT_WORK_TREE, so you need to be root to merge.
sudo make install
sudo cg --init
cg does require git-core >= 1.7. That means if you are on debian ancient... ekhm... stable, you need to install git from backports:
echo 'deb http://www.backports.org/debian lenny-backports main contrib non-free' >> /etc/apt/sources.list
apt-get update
apt-get -t lenny-backports install git-core
There are always at least two branches in cg repository:
master
deploy
deploy is the branch that is actually checked out on the server. You should never checkout master or any other branch into / directory of the server. You should never push to this branch.
So, if you want to modify some files, you have two options:
- modify them directly on the server
- modify file
cg add
itcg commit
it directly to the deploy branch- don't forget to
git fetch && git merge deploy
in repo clones
- push it from your workstation:
- modify file in your local working copy
git add
itgit commit
it to the master branch (or any other than deploy)git push
it- login onto server as root and cg merge master
You can clone cg repo on your workstation using following:
git clone user@server:/var/lib/cg -b master server
Remember, that user
must be a memeber of cg
group.
If you already keep your serrver configuration under simple git repo in /root you can import it to cg this way:
git clone user@server:/var/lib/cg
git remote add rootrepo user@server:/
git fetch rootrepo
git merge rootrepo/master
git branch deploy
git push -f origin
git branch -d deploy
git remote rm rootrepo
$ git push -f cg
Counting objects: 102, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (73/73), done.
fatal: Unable to create temporary file: Permission denied
Writing objects: 100% (100/100), 15.13 KiB, done.
Total 100 (delta 22), reused 9 (delta 0)
error: unpack failed: index-pack abnormal exit
To server.example.com:/var/lib/cg
! [remote rejected] deploy -> deploy (n/a (unpacker error))
! [remote rejected] master -> master (n/a (unpacker error))
error: failed to push some refs to 'server.example.com:/var/lib/cg'
This is typical permission error. Make sure that you have full permission to /var/lib/cg on server.example.com. Try:
chmod -R g+rwX /var/lib/cg
chgrp -R cg /var/lib/cg
© 2010 by Paweł Zuzelski [email protected] License: Just do what the fuck you want to. Or see license details here: http://sam.zoy.org/wtfpl/COPYING