Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'd like to track my linux configurations with git.

  • My idea is to have a branch for each server.
  • /etc is not the only one directory to be tracked (I won't git init in '/etc' )

As far as I could see, it is possible to init a git for a distant directory.

I tried this:

# mkdir -p /git/.git
# cd /git
# git --work-tree=/ --git-dir=/git/.git init
Initialized empty Git repository in /git/.git/

1) Creating a new branch before everything is not possible

# git branch server1
fatal: Not a valid object name: 'HEAD'.

2) adding a file in master/HEAD is not possible

# touch README.md
# git add README.md 
fatal: Unable to create '//.git/index.lock': No such file or directory

how should I properly setup git to track my system-config ?

Thanks.

P.

share|improve this question

2 Answers 2

If you don't want to do it by hand, you could use etckeeper: http://joeyh.name/code/etckeeper/

which is specifically made for that purpose.

share|improve this answer

Use a proper configuration management tool e.g. puppet, chef or similr and store their configs in git.

This may have an initial cost but it's smaller than havimg to go back and fit it all at a later date.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.