@marcosdsanchez's answer is for Arch (which answers the original question) but I'm on Ubuntu. For git >= 2.11:
sudo apt-get install libsecret-1-0 libsecret-1-dev
cd /usr/share/doc/git/contrib/credential/libsecret
sudo make
git config --global credential.helper /usr/share/doc/git/contrib/credential/libsecret/git-credential-libsecret
For git < 2.11:
sudo apt-get install libgnome-keyring-dev
cd /usr/share/doc/git/contrib/credential/gnome-keyring
sudo make
git config --global credential.helper /usr/share/doc/git/contrib/credential/gnome-keyring/git-credential-gnome-keyring
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…