Tracking the linux config with git: how?

Posted by Pierre on Server Fault See other posts from Server Fault or by Pierre
Published on 2014-06-13T09:01:00Z Indexed on 2014/06/13 9:28 UTC
Read the original article Hit count: 203

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.

© Server Fault or respective owner

Related posts about linux

Related posts about git