Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Managing user configuration files across multiple computers

I commonly work on multiple computers. I have various configuration files, eg, .bashrc, .gitconfig, .irbrc, .vimrc and configuration folders, eg, .vim/ that contain valuable customizations. Sometimes I want small variations in configuration between the different computers.

I want to use version control to manage these different files.

  • do others use version control to manage their configuration files?
  • what are some hints that might make this easier?
  • what's the most elegant way of dealing with variations between the computers?
  • I'm comfortable with git; any other suggestions?
like image 576
Peter Avatar asked Sep 11 '09 20:09

Peter


People also ask

What is configuration file management?

A user can save current configuration to a configuration file. Through configuration file management, you can back up and restore device configurations, configure backup tasks, view backup files, import or export configuration files, and view configuration changes.

What are the two configuration files to manage users?

This is why most user programs define two configuration files: the first one at a "system" level, located in /etc/; and the other one, "private" to the user, that can be found in his or her home directory. For example, in my system I have installed the very useful wget utility.

What is device configuration file?

The device configuration file contains information that is required to read backup data and restore the database. You can specify duplicate device configuration files. When the server updates device configuration information in the database, it also updates each file. A device configuration file cannot be recreated.

Where are user configuration files of programs usually stored?

System-wide software often uses configuration files stored in /etc , while user applications often use a "dotfile" – a file or directory in the home directory prefixed with a period, which in Unix hides the file or directory from casual listing. Some configuration files run a set of commands upon startup.


1 Answers

I keep a folder at ~/config/ which is a bzr repository. I push/pull the repository between my various computers to sync it up. I have an install script which I use to make symlinks to my home directory:

#! /bin/sh # link all files to the home directory, asking about overwrites cd `dirname $0` SCRIPT_DIR=`pwd` SCRIPT_NAME=`basename $0` FILES=`bzr ls --versioned --non-recursive`  cd $HOME for FILE in $FILES; do     ln --symbolic --interactive $SCRIPT_DIR/$FILE done rm $TARGET_DIR/$SCRIPT_NAME 

If you want to use git instead of bzr, you can instead use:

FILES=`git ls-tree --name-only HEAD` 

(I had to ask SO to figure that out)

EDIT: I don't actually do this anymore, now I have a dotfiles repo on github, with a nice rake install script that someone else wrote.

like image 112
Christian Oudard Avatar answered Sep 18 '22 14:09

Christian Oudard