---
title: Clone Me Maybe
teaser:
tags: git
author: Gabe Berke-Williams
published_on: 2012-07-21
---

Let’s say you’re on the GitHub page for [rails/rails]. Copying the URL from the
top of the page, pasting it into the terminal takes too dang long! Instead, put
this in your `~/.gitconfig`:

```gitconfig
# ~/.gitconfig
[url "git://github.com/"]
  # Read-only
  insteadOf = gh:
```

In the terminal:

<kbd>git clone gh:rails/rails</kbd>

## Read/write github repos

What if I want to clone something to which I have push (write) access, like
[thoughtbot/high_voltage]? Here you go:

```gitconfig
# ~/.gitconfig
[url "git@github.com:"]
  # With write access
  insteadOf = wgh:
```

<kbd>git clone wgh:thoughtbot/high\_voltage</kbd>

## Easily add a Heroku remote

Now then, what if you need to add a Heroku remote for the `sushi.heroku.com`
app? You could go to Heroku, log in, click “My Apps”, click “Sushi”, and find
the remote URL. Or, you can do this:

```gitconfig
# ~/.gitconfig
[url "git@heroku.com:"]
  insteadOf = heroku:
```

<kbd>git remote add heroku:sushi.git</kbd>

## Your turn

<iframe frameborder="0" height="315"
  src="https://www.youtube-nocookie.com/embed/fWNaR-rxAic" width="560"></iframe>

Before I learned this tip, I missed it real bad. For more, check out [my
gitconfig](https://github.com/gabebw/dotfiles). What are your little Git tips?

[rails/rails]: https://github.com/rails/rails
[thoughtbot/high_voltage]: https://github.com/thoughtbot/high_voltage
