0

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.

2 Answers 2

3

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.

1

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .