Gentoo:Converting Portage to Git

I started using source-based distros about three weeks ago. I read up on the two big ones I was interested in, Gentoo and Funtoo, and decided to go with Gentoo due to its community size. However, one thing I really liked about Funtoo was that it used git as the distribution means for the portage tree.

If you check the Gentoo blog, you’ll see though that they have converted to git. Despite this though, my emerge --sync commands were executing via rsync. It turns out that the Gentoo stage 3 tarball is still configured to use rsync. If you’re doing a fresh install or would like to convert an existing instance to using git, here’s how you convert.

Howto

Gentoo stores its portage tree on the filesystem under /usr/portage/. Rename this directory to /usr/portage.orig (or your name of choice), just in case something goes wrong.

Next, as root, copy /usr/share/portage/config/repos.conf to /etc/portage/repos.conf, taking care not to overwrite it if you already have one there.

Under the [gentoo] section, you should see location = /usr/portage. In that section, replace the sync-type and sync-uri values with…​

sync-type = git
sync-uri = https://github.com/gentoo/gentoo.git

Now execute either emaint -a sync or emerge --sync (these do the same, but emerge --sync only exists for compatibility purposes).

That’s it. Now all of your repo syncs should pull down portage tree updates via git.

Note
If the portage directory is manually cloned but the repos.conf config is never updated to tell emerge that the portage tree is stored in a git repo, you will receive the error "!!! /usr/portage appears to be under revision control (contains .git).". To fix this, update the repos.conf file to reflect the changes mentioned above.

Last edited: November 1, 2015