Giter Site home page Giter Site logo

cg's Introduction

cg(1)

About

cg is a simple tool that helps to keep machine configuration in git repository.

Installation

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

Requirements

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

Working with cg

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 it
    • cg 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 it
    • git 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

Troubleshooting

Permission errors

$ 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

Copyright & License

© 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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.