Manage Your Configs with vcsh

Now that your file's being tracked by the git repository inside vcsh, let's commit it by running the following git-like command:

bill@test:~$ git commit -m 'Initial Commit'
master (root-commit) bc84953 Initial Commit
 Committer: Bill Childers bill@test.home
 1 file changed, 2 insertions(+)
 create mode 100644 .vimrc

Now for the really cool part. Just like standard git, you can push your files to a remote repository. This lets you make them available to other machines with one command. Let's do that now. First, you'll add the remote server. (I assume you already have a server set up and have the proper accounts configured. You'll also need a bare git repo on that server.) For example:

bill@test:~$ git remote add origin git@gitserver:vim.git

Next, push your files to that remote server:

bill@test:~$ git push -u origin master
    Counting objects: 3, done.
    Compressing objects: 100% (2/2), done.
    Writing objects: 100% (3/3), 272 bytes, done.
    Total 3 (delta 0), reused 0 (delta 0)
    To git@gitserver:vim.git
    * new branch      master -> master
    Branch master set up to track remote branch master from origin.
bill@test:~$ exit

Note the exit line at the end. This exits the "vcsh fake git repo". Now your .vimrc file is checked in and copied to a remote server! If there are other programs for which you'd like to check in configurations, like mutt, you simply can create a new repo by running vcsh init mutt, and then run through the process all over again, but this time, check your files into the mutt repository.

Move Your Configuration to Another Machine

To sync your configuration to another machine, you just need to install vcsh, git and mr, and then run a similar process as the steps above, except you'll do a git pull from your server, rather than a push. This is because you don't have the .vimrc file you want locally, and you want to get it from your remote git repository.

The commands to do this are:

bill@test2:~$ sudo apt-get install vcsh git mr
bill@test2:~$ vcsh enter vim
bill@test2:~$ git remote add origin git@gitserver:vim.git
bill@test2:~$ git pull -u origin master
From gitserver:vim
* branch            master     -> FETCH_HEAD
bill@test2:~$ exit

Now you've got your checked-in .vimrc file on your second host! This process works, but it's a little clunky, and it can become unwieldy when you start spawning multiple repositories. Luckily, there's a tool for this, and it's called mr.

Wrapping It All Up with mr

If you plan on using multiple repositories with vcsh (and you should—I'm tracking 13 repositories at the moment), getting a configuration set up for mr is essential. What mr brings to the table is a way to manage all the repositories you're tracking with vcsh. It allows you to enable and disable repositories simply by adjusting one symlink per repository, and it also gives you the ability to update all your repos simply by running one easy command: mr up.

Perhaps the best way to get started using mr is to clone the repo that the vcsh author provides. This is done with the following command:

bill@test2:~$ vcsh clone 
 ↪git:// mr
Initialized empty Git repository in 
remote: Counting objects: 19, done.
remote: Compressing objects: 100% (14/14), done.
remote: Total 19 (delta 1), reused 15 (delta 0)
Unpacking objects: 100% (19/19), done.
From git://
* new branch      master     -> origin/master


Bill Childers is the Virtual Editor for Linux Journal. No one really knows what that means.


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

used to use tcsh or bash.

tchen752's picture

used to use tcsh or bash. it is really new for me

One of the more frustrating

sollen's picture

One of the more frustrating things about making repairs to your car is when they don’t go quite correctly, and the car fails the first post-repair test drive. Any time you replace parts, you need to put the new parts in so that they fit and function the way your car came from the factory.

برامج مجانية

BBM for iPhone's picture

One comment: You can also set up bare git repos inside the filesystem

This is making me dizzy.

Ventrice Humphrey's picture

Bill, since I consider you *nix royalty. This criticism is difficult for me.
I am very familiar with this issuse. For me, I simplified this problem by maintaining a my configuration files on my server.
New box or reinstall, I just secure copy all the configuration directories to the new box. Simple one commad.

Overly complicated

Pablo Olmos de Aguilera C.'s picture

I found this method a bit too much. Maybe it could prove useful in some kind of "professional" environments, but for one person. And a couple of machines, tools like dfm[1], dotfiles[2], homesick[3] and/or rcm[4] are most than enough and way simpler.

I'm using rcm right now and I think it's the best tool around for this purpose.


Would love to see a

Caleb Cushing's picture

Would love to see a comparative write up on why rcm over the others. do any of these support running scripts on initialization? I've started using VAM for my vim plugins, but I need to grab VAM for it to work.

Hardly Familiar in VCSH

cledwyn's picture

Honestly,I'm not familiar in vcsh but I like to try that.
I should start to follow your steps in vcsh configuration.

Git repos inside the filesystem

vehka's picture

Thanks for a great article, I'll definitely have to check out vcsh. One comment: You can also set up bare git repos inside the filesystem, for example, in the Dropbox (or equivalent) folder, so that they get backed up automatically.

See this post on how it's done: