emerge --quiet dev-vcs/git
cat << EOF > /etc/portage/repos.conf/gentoo.conf
[DEFAULT]
main-repo = gentoo
[gentoo]
location = /var/db/repos/gentoo
sync-type = git
sync-uri = https://github.com/gentoo-mirror/gentoo.git
sync-depth = 1
auto-sync = yes
sync-user = portage:portage
EOF
rm -rf /var/db/repos/gentoo
emerge --sync