Log in

A helpful git config snippet - Will Woods, Fedora Testing Guy [entries|archive|friends|userinfo]
Will Woods, Fedora Testing Guy

[ website | https://ohjeezlinux.wordpress.com/ ]
[ userinfo | livejournal userinfo ]
[ archive | journal archive ]

A helpful git config snippet [Jun. 4th, 2010|05:15 pm]
Will Woods, Fedora Testing Guy
So, if you're like me, you like to poke through the source of things from time to time but you always forget what the proper URL is for, say, GNOME git. Or Fedora hosted. Or whatever.

Well, good news, friend! Stuff this into your ~/.gitconfig and make your life a bit easier:
[url "git://git.fedorahosted.org/git/"]
        insteadOf = "fh:"
[url "ssh://git.fedorahosted.org/git/"]
        insteadOf = "fh-ssh:"
[url "git://git.gnome.org/"]
        insteadOf = "gnome:"
[url "ssh://git.gnome.org/git/"]
        insteadOf = "gnome-ssh:"
[url "git://anongit.freedesktop.org/git/"]
        insteadOf = "fdo:"
[url "ssh://git.freedesktop.org/git/"]
        insteadOf = "fdo-ssh:"

Now you can do stuff like git clone fdo:plymouth or git clone fh-ssh:autoqa.git and it should Just Work*. Neat!

Now, if I was really clever, I'd find somewhere to ship this in the default Fedora install, or at least as part of the developer tools. Maybe someone else out there is really clever?

*Unless your local username is different from the remote username, in which case ssh might not work - but you can fix that by changing the url to ssh://username@... or putting the following in ~/.ssh/config:
Host *.freedesktop.org
        User username

[User Picture]From: cuviper
2010-06-05 12:37 am (UTC)
You can also make git fetch over the faster git:// and still push over ssh:// with the same name:
[url "git://git.fedorahosted.org/git/"]
        insteadOf = "fh:"
[url "ssh://git.fedorahosted.org/git/"]
        pushInsteadOf = "fh:"

(Reply) (Thread)
From: slashdotaccount
2010-06-06 05:49 pm (UTC)


How about pushing that upstream?

For bonus points, add sf, debian/alioth, github, gitorious etc URLs.
(Reply) (Thread)
[User Picture]From: pfrields.id.fedoraproject.org
2010-06-06 08:36 pm (UTC)

Need an /etc/gitconfig.d/

There's a $(prefix)/etc/gitconfig file that git reads, but it would be nice to be able to drop this stuff into e.g. /etc/gitconfig.d/ instead.
(Reply) (Thread)