TIL: useful git alias for AUR
In your git config, you can define URL aliases which can be useful for installing packages from the AUR:
Add this to your ~/.gitconfig:
[url "https://aur.archlinux.org/"]
insteadOf = aur://
And you can now clone repositories from the AUR (to get PKGBUILDs and patches and stuff) with:
git clone aur://interesting-software
TIL, and it's something I wanted to share :)
About this post
- Posted
- Archived
- Score
- 332 · 100% up
- Kind
- Text
- ID
- 5vdcbc
16 comments
Oh, neat. I never realized git had these sorts of aliases. Obviously useful for more than just the AUR.
Even better in combination with
pushInsteadOf:git clone gh:foo/bar.gitclones the repo and sets it up to pull over HTTPS (no auth needed if public repo) and push over SSH :)Combining the two:
That's awesome
Yeah, when I found out about it today, I immediately created
aur://andgh://for github, andworkgh://as a root alias for projects under my work's github organization.Why burden yourself with the slashes? Just remove them from the
insteadOfto makegit clone aur:whateverwork :)An alternative method that I use is to put a host in the SSH config:
Only works if you’ve got SSH set up for AUR, of course, e. g. because you also publish some packages.
I prefer this version:
Another handy tip, if you just want to build the latest package release (as most people probably do) you can add
--depth=1aftergit cloneto download just the latest version and avoid wasting ~~time/~~bandwidth downloading the whole history.Edit: After testing it turns out this isn't worth it unless you are really tight on bandwidth or have a terrible connection and will probably just be about 1/10th of a second slower for most people.
That should basically make no difference for the AUR repos though. Might even make it take longer because it forces the server side to recompute the deltas.
So I ran some tests (downloaded some packages from aur about 20 times for each setting) and it seems you are right. For an example: google-chrome takes an average of 0.94 seconds to download the full history and 1.1 seconds with
--depth=1. The filesize of the resulting clone goes from 196K (329 objects) down to 132K (6 objects) so bandwidth/disk space is the only improvement, but with such small sizes I doubt it really matters.Thanks!
cool, this would also make it easier to get aur packages on non-arch systems (forced to use *buntu at work)
Very handy! Thanks!
I love you OP.
Deleted before we saved it.
Aliases defined in git are just as good and won't pollute your namespace.