Skip to main content

Command Palette

Search for a command to run...

Git for beginners: Setting up git credential manager

Updated
2 min read
Git for beginners: Setting up git credential manager
S

Sudarshan Bhat is a passionate Internet of Things developer. People call him Sudo and as a techie, he loves it. Born in India, he moved to Germany to get his Masters degree in Embedded Systems. Later, he moved to the beautiful city of Vienna for work.

He created this blog to document everything he knows, working on, and will work on about Internet of Things. It is named Sudoc, which means Sudo's documentation.

When he is not writing about himself in third person, Sudo spends most of his time doing pencil sketching, hiking, photography and all kinds of creative stuff.

As coding is a staple for any IoT applications, I decided to write another short article on Git for beginners. This is the continuation of Git for beginners : setting up your first project and Git for beginners : Git basics you need to know.

Are you ever annoyed when you have to enter your git password every time you fetch, push or pull from remote git repository? There is a simple solution.

For Linux ( Ubuntu distro )

If you are using git in Linux, reusing credentials was done with gnome-keyring before and now it is replaced with libsecret. Both options are described below. After you set this up, you just have to enter your git credentials one time and you are good to do any git actions without typing password every time.

For git version >= 2.11 ( new )

$ 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 version < 2.11 ( old )

$ 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

TIP: Better upgrade the git version

For Windows ( Also WSL/ WSL2)

If you are using Windows, or using Git installed in windows and using the same for WSL (Windows Subsystem for Linux), you can use the git credential helper in windows. Enter this command in your WSL distro terminal.

git config --global credential.helper "/mnt/c/Program\ Files/Git/mingw64/libexec/git-core/git-credential-wincred.exe"

If you are just using windows ( not WSL), then open cmd prompt and do the following

git config --global credential.helper manager

For all the above stuff to work, git has to be installed. Visit other Git for Beginner articles to learn how to do install git.