2011-10-08

Different fetch/push URLs for git clone

UPDATE 1
It turns out to be reeeeallly easy!
git remote set-url --push origin git@example.com:username/repo.git


I always use passphrases on my ssh keys. Everyone does, right? Anyway, it gets kind of annoying entering it in each time when fetching from an upstream repository. I don't have enough need to set-up a key-ring, though. So, I took a quick look at git config --help and figured out how to set-up different URLs for git-push and git-fetch.
remote.<name>.url
    The URL of a remote repository. See git-fetch(1) or git-push(1).
remote.<name>.pushurl
    The push URL of a remote repository. See git-push(1).

I just opened up .git/config and set remote.origin.url to the read-only URL, and remote.origin.pushurl to the initial value of remote.origin.url.

Now, I can git-fetch/git-pull without the annoying passphrase prompt. Yay.

There's probably a way to do it with git-remote; but, I'm too lazy to figure it out right now...