Df2106ce87ede93244372837b7d36700
I am the creator of the site you are currently looking at. I love copying and pasting code from stack overflow .
3 posts 0 following 0 followers

Tags
Storing git passwords with GNOME Keyring
June 25, 2017 19:55

I have been using git for about a year now. I have entered my git credentials for every single pull/push.Then yesterday I realized that this was very inefficient ( I am pushing regular updates to this website now). So I searched. There is public key authentication and password authentication.

I wanted to use password authentication ( no specific reason). But it was time-consuming, entering the password every single time I did a git push/pull. So I searched and found that git allows storing passwords .

pro devs being sarcastic

According to the documentation mentioned here you can either store credentials in git config by manually editing it or by using credential helpers. credential helpers are external programs that store passwords and provide them whenever they are required through an interface.

By default, git has two credential helpers. One is git-credential-cache which stores credentials in memory temporarily for 15 minutes by default, (this time can be changed) and the other is git-credential-store which stores credentials permanently on disk in plain text.

we are going to use GNOME Keyring. It is a program ( a daemon to be specific) that stores passwords for other programs by encrypting them using user's password so that user has to remember only one password. More info here.

Thanks to this answer.

For Ubuntu follow these steps. Install and build gnome-keyring.

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

Then configure git to use gnu-keyring as its credential helper.

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

Now you are all set. Git will ask you for a password for the first time only. It will use the stored password after that.

Editing stored passwords

Simple way to edit these stored passwords is by using seahorse which is a GUI interface that comes built in with most ubuntu based distributions.

Notes :

Read this stackoverflow thread for more information.

Thank you


Comments