Manage Your Configs with vcsh

Now that you've got your mr repo cloned, you'll want to go in and edit the files to point to your setup. The control files for mr live in ~/.config/mr/available.d, so go to that directory:

bill@test2:~/.config/mr/available.d$ ls
mr.vcsh  zsh.vcsh

Rename the zsh.vcsh file to vim.vcsh, because you're working with vim, and change the repository path to point to your server:

bill@test2:~/.config/mr/available.d$ mv zsh.vcsh vim.vcsh
bill@test2:~/.config/mr/available.d$ vi vim.vcsh
checkout = vcsh clone git@gitserver:vim.git vim

Also, edit the mr.vcsh file to point to your server as well:

bill@test2:~/.config/mr/available.d$ vi mr.vcsh
checkout = vcsh clone git@gitserver:mr.git mr

The mr tool relies on symlinks from the available.d directory to the config.d directory (much like Ubuntu's Apache configuration, if you're familiar with that). This is how mr determines which repositories to sync. Since you've created a vim repo, make a symlink to tell mr to sync the vim repo:

bill@test2:~/.config/mr/available.d$ cd ../config.d
bill@test2:~/.config/mr/config.d$ ls -l
total 0
lrwxrwxrwx 1 bill bill 22 Jun 11 18:14 mr.vcsh -> 
bill@test2:~/.config/mr/config.d$ ln -s 
 ↪../available.d/vim.vcsh vim.vcsh
bill@test2:~/.config/mr/config.d$ ls -l
total 0
lrwxrwxrwx 1 bill bill 22 Jun 11 18:14 mr.vcsh -> 
lrwxrwxrwx 1 bill bill 23 Jun 11 20:51 vim.vcsh -> 

Now, set up mr to be able to sync to your git server:

bill@test2:~/.config/mr/config.d$ cd ../..
bill@test2:~/.config$ vcsh enter mr
bill@test2:~/.config$ ls
mr  vcsh
bill@test2:~/.config$ git add mr
bill@test2:\~/.config$ git commit -m 'Initial Commit'
[master fa4eb18] Initial Commit
Committer: Bill Childers [bill@test2.home]
3 files changed, 4 insertions(+), 1 deletion(-)
create mode 100644 .config/mr/available.d/vim.vcsh
create mode 120000 .config/mr/config.d/vim.vcsh
bill@test2:\~/.config$ git remote add origin git@gitserver:mr.git
fatal: remote origin already exists.

Oh no! Why does the remote origin exist already? It's because you cloned the repo from the author's repository. Remove it, then create your own:

bill@test2:~/.config$ git remote show
bill@test2:~/.config$ git remote rm origin
bill@test2:~/.config$ git remote add origin git@gitserver:mr.git
bill@test2:~/.config$ git push -u origin master
Counting objects: 28, done.
Compressing objects: 100% (21/21), done.
Writing objects: 100% (28/28), 2.16 KiB, done.
Total 28 (delta 2), reused 0 (delta 0)
To git@gitserver:mr.git
 * [new branch]      master -> master
Branch master set up to track remote branch master from origin.
bill@test2:~/.config$ exit

That's it! However, now that mr is in the mix, all you need to do to set up a new machine is do a vcsh clone git@gitserver:mr.git mr to clone your mr repository, then do an mr up, and that machine will have all your repos automatically.


vcsh is a very powerful shell tool, and one that takes some time to adapt your thought processes to. However, once you do it, it makes setting up a new machine (or account on a machine) a snap, and it also gives you a way to keep things in sync easily. It's saved me a lot of time in the past few months, and it's allowed me to recover quickly from a bad configuration change I've made. Check it out for yourself!

Setting up a Remote Git Repo

A quick note on setting up a remote git repo: you'll need to set up passwordless authentication using SSH keys (see Resources for more information). Once you have that going using a "git" user, you simply need to create a git repo as the git user. That's done easily enough, just run the command:

git@gitserver:~$ git init --bare vim.git
Initialized empty Git repository in /home/git/vim.git/

Your bare repo will be ready for your vcsh client to check in stuff!


vcsh Home Page:

mr Home Page:

vcsh Background Slides:

How to Set Up Your Own Git Server:

Set Up Passwordless SSH Key-Based Authentication:


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:

Geek Guide
The DevOps Toolbox

Tools and Technologies for Scale and Reliability
by Linux Journal Editor Bill Childers

Get your free copy today

Sponsored by IBM

8 Signs You're Beyond Cron

Scheduling Crontabs With an Enterprise Scheduler
On Demand
Moderated by Linux Journal Contributor Mike Diehl

Sign up and watch now

Sponsored by Skybot