Error when using Git credential helper with gnome-keyring as Sudo
I sometimes need to run sudo git clone since sometimes the directory where I need to make a clone requires it. Any help would be appreciated
The folder in which you try to clone the repository into was created by root so you dont have permission to write or to create folder under it unless you are root (sudo
), set the permissions (chmod
or chown
) and you will be able to clone into the folder.
chmod 755 /path
How to use git with gnome-keyring integration
Git 1.8.0 comes with gnome-keyring support but the binary needs to be compiled for your platform.
This is what solved it for me in Archlinux:
$ sudo pacman -S libgnome-keyring
$ cd /usr/share/git/credential/gnome-keyring
$ make
$ git config --global credential.helper /usr/share/git/credential/gnome-keyring/git-credential-gnome-keyring
@VonC solution was close, but the git config command should point to the executable. That's why it was not working for me.
General git-credential-libsecret not found error
First, make sure to understand where that setting is coming from
git config --show-origin -l
Then you can unset it.
For instance:
git config --global --unset credential.helper
Once the situation is cleaned, you can install back libsecret
, as described in "How to bake credential into docker image for git?".
What's the best encrypted git credential helper for Linux?
This is what we have in git sources: https://github.com/git/git/tree/master/contrib/credential
So you can use gnome-keyring
(deprecated), libsecret
or gpg-encrypted .netrc
.
libsecret
could be used with any Linux distribution without GNOME, I believe.
git config --global credential.helper /usr/share/doc/git/contrib/credential/libsecret/git-credential-libsecret
See https://stackoverflow.com/a/40312117/7976758.
This is how to use gpg-encrypted .netrc
: https://stackoverflow.com/a/18362082/7976758.
How to store multiple PATs/passwords for use by git?
Any credential helper should follow the same process.
But if you have multiple account/password for the same domain (say github.com for instance), then you need to change your remote URL
cd /path/to/my/local/repo1
git remote set-url origin https://user1@github.com/user1/myRepo1
^^^^^^
cd /path/to/my/local/repo2
git remote set-url origin https://user2@github.com/user1/myRepo2
^^^^^^
That way, the credential helper will differentiate your different account.
Since gcm core is a bit fineky to install, test it first with the classic libsecret-based helper.
Push to GitHub *with* Username and Password only
But I want the GitHub to ask me for the username and password.
Then use an HTTPS URL instead of an SSH one (which would be default authentication with the ~/.ssh/id_rsa existing private SSH keys, registered to the other GitHub account)
Make sure your git config credential.helper
is empty, or, if it is not (for instance, on Linux), check if the credentials are already cached.
For osxkeychain, follow "Updating credentials from the OSX Keychain".
Or, as I explained here:
git credential-osxkeychain erase https://github.com
Related Topics
How to Specify the Library Version to Use At Link Time
How to Compare Two Datetime Strings and Return Difference in Hours? (Bash Shell)
Execute Command After Every Command in Bash
How Is Stack Memory Allocated When Using 'Push' or 'Sub' X86 Instructions
How to Print a Character in Linux X86 Nasm
How to Run a Shell Script on a Unix Console or MAC Terminal
Kernel Stack and User Space Stack
How to Find Out What All Symbols Are Exported from a Shared Object
How to Create a Crontab Through a Script
Linux/Unix Command to Determine If Process Is Running
How to Change the Default Browser Used by the Ipython/Jupyter Notebook in Linux
Compiling C++ on Remote Linux Machine - "Clock Skew Detected" Warning
How Is the System Call in Linux Implemented