Nicer git remote URLs

Most open source git repositories that I interact with are hosted at git.shadowcat.co.uk. A few typical repo urls (read/write) hosted here looks like:

  [email protected]:DBIx-Class.git
  [email protected]:Catalyst-Runtime.git
  [email protected]:Devel-Declare.git
  [email protected]:Moose.git

A handy trick is to make a file at ~/.ssh/config with the following in it:

host catagits
     user catagits
     hostname git.shadowcat.co.uk
     port 22
     identityfile ~/.ssh/id_dsa

host dbsrgits
     user dbsrgits
     hostname git.shadowcat.co.uk
     port 22
     identityfile ~/.ssh/id_dsa

host p5sagit
     user p5sagit
     hostname git.shadowcat.co.uk
     port 22
     identityfile ~/.ssh/id_dsa

host gitmo
     user gitmo
     hostname git.shadowcat.co.uk
     port 22
     identityfile ~/.ssh/id_dsa

Now that that’s done the repos before are simply:

  dbsrgits:DBIx-Class.git
  catagits:Catalyst-Runtime.git
  p5sagit:Devel-Declare.git
  gitmo:Moose.git

I actually did that for my work and github stuff too, since I just don’t have the time to type those stupid domains all the time.

Enjoy!


(The following includes affiliate links.)

If you’re interested in learning more about Git, I cannot recommend Pro Git enough. It’s an excellent book that will explain how to use Git day-to-day, how to do more unusual things like set up Git hosting, and underlying data structures that will make the model that is Git make more sense.

Posted Wed, May 25, 2011

If you're interested in being notified when new posts are published, you can subscribe here; you'll get an email once a week at the most.