Managing Git credentials the easy way

Introduction

Credential management in Git should not be difficult to use or configure, but (unfortunately) looking at the existing tools, it is difficult to even think about it, let alone configure them without errors.

NOT. ANY. MORE!

Pres…



Introduction

Credential management in Git should not be difficult to use or configure, but (unfortunately) looking at the existing tools, it is difficult to even think about it, let alone configure them without errors.

NOT. ANY. MORE!

Presenting git-credential-netconf, an easy yet powerful way to manage your Git credentials by harnessing the power of GnuPG!



Getting Started

The following guide assumes you have a GPG key.



0. Installing git-credential-netconf

pip install git-credential-netconf

Visit the project page.



1. Create a .netconf file in your home directory

touch ~/.netconf



2. Start by filling in your username and password

[conf]
login = yourname
password = very-secret-password

The .netconf file uses configuration file format.

Learn more about .netconf file.



3. Encrypt your .netconf file with gpg

gpg --recipient yourname@example.com --output ~/.netconf.gpg \
    --encrypt --sign ~/.netconf

And remove your original .netconf for security:

shred -u ~/.netconf



4. Tell Git to use it

⚠️ Make sure that ~/.local/bin is in $PATH

git config --global credential.helper 'netconf --debug'



5. Now use git without hassle!

git push

This will prompt git-credential-netconf to decrypt the ~/.netconf.gpg file using GPG and fetch the username and password, among other values.

You’ll be asked for the password to GPG private key when decrypting.



Conclusion

I hope this article helps you in managing your precious credentials a bit better.

Questions? Comments? Concerns? Please put them down below and I’d be happy to help you.

Image Source: Manjaro’s /usr/share/backgrounds folder ?


Print Share Comment Cite Upload Translate
APA
Arunanshu Biswas | Sciencx (2024-03-29T11:28:49+00:00) » Managing Git credentials the easy way. Retrieved from https://www.scien.cx/2021/07/31/managing-git-credentials-the-easy-way/.
MLA
" » Managing Git credentials the easy way." Arunanshu Biswas | Sciencx - Saturday July 31, 2021, https://www.scien.cx/2021/07/31/managing-git-credentials-the-easy-way/
HARVARD
Arunanshu Biswas | Sciencx Saturday July 31, 2021 » Managing Git credentials the easy way., viewed 2024-03-29T11:28:49+00:00,<https://www.scien.cx/2021/07/31/managing-git-credentials-the-easy-way/>
VANCOUVER
Arunanshu Biswas | Sciencx - » Managing Git credentials the easy way. [Internet]. [Accessed 2024-03-29T11:28:49+00:00]. Available from: https://www.scien.cx/2021/07/31/managing-git-credentials-the-easy-way/
CHICAGO
" » Managing Git credentials the easy way." Arunanshu Biswas | Sciencx - Accessed 2024-03-29T11:28:49+00:00. https://www.scien.cx/2021/07/31/managing-git-credentials-the-easy-way/
IEEE
" » Managing Git credentials the easy way." Arunanshu Biswas | Sciencx [Online]. Available: https://www.scien.cx/2021/07/31/managing-git-credentials-the-easy-way/. [Accessed: 2024-03-29T11:28:49+00:00]
rf:citation
» Managing Git credentials the easy way | Arunanshu Biswas | Sciencx | https://www.scien.cx/2021/07/31/managing-git-credentials-the-easy-way/ | 2024-03-29T11:28:49+00:00
https://github.com/addpipe/simple-recorderjs-demo