What is the correct way to use git with gnome-keyring and http(s) repos?

gnome-credential-helper is now deprecated.

Instead, use libsecret. If it's not already buil-in your ubuntu, use the following procedure:

  1. You can install libsecret and the development libraries with:

    sudo apt-get install libsecret-1-0 libsecret-1-dev
    
  2. Then you need to build the credential manager

    sudo make --directory=/usr/share/doc/git/contrib/credential/libsecret
    
  3. Finally, you should point git to the newly created file in your config:

    git config --global credential.helper \
       /usr/share/doc/git/contrib/credential/libsecret/git-credential-libsecret
    

More details on https://stackoverflow.com/a/40312117/2017781


You need to setup the git credential helper with Gnome Keyring:

Install and compile the Gnome Keyring devel:

sudo apt-get install libgnome-keyring-dev
sudo make --directory=/usr/share/doc/git/contrib/credential/gnome-keyring

And setup the credential:

git config --global credential.helper /usr/share/doc/git/contrib/credential/gnome-keyring/git-credential-gnome-keyring

This simple approach appears to be sufficient on my Ubuntu 18.04.1 with git 2.17.1:

git config --global credential.helper cache

You can specify a one hour (=3600 seconds) timeout like this:

git config --global credential.helper 'cache --timeout=3600'

Further reading in the fine manual.