1

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?

prophet-five
  • 429
  • 3
  • 12

1 Answers1

1

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.

toydarian
  • 2,587
  • 14
  • 26
  • so on the new machine you clone regularly and replace the files with symlinks? – prophet-five Aug 06 '20 at 12:55
  • 1
    yes, exactly. `git clone` and then link. As I said, the linking can get tedious, but I don't have to do it often, as I seldomly get a new computer that I set up from scratch. But scripting it should not be too much of a problem, either. – toydarian Aug 06 '20 at 12:57
  • this seems to work when I use a regular symlink on a windows machine, thanks! – prophet-five Aug 06 '20 at 13:30