gitgithubbare

cloning bare git repository and tracking files in other locations


Recently I've created a bare git repository so i can backup my configuration files (dotfiles) which are located in many places, some under the root directory.

The idea was to have a repo on github so I can store the files there and update them from any computer (such as a Windows laptop I use at work).

Now I have the repository on github, so my question is how to clone it to the other pc (which has differnt file stracture) and still track the files which are in different locations, like my original local bare repository?


Solution

  • I have a similar setup. I have all my configuration (e.g. the .vimrc, .zshrc etc.) in a git repo.
    On the machines I use symlinks to link to the configs in the repo.
    For example, I have my config repo cloned to ~/configs, which it contains a file vimrc. The ~/.vimrc file is a symlink to the config file: /home/toydarian/.vimrc -> configs/vimrc (created like this: ln -s ~/configs/vimrc ~/.vimrc).

    The downside of this is, that I have to manually create the links on every machine. But if you have a lot of machine (or you reinstall frequently) you could write a script to do that.