Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable osxkeychain as credential helper in git config?

Tags:

git

github

I need to disable the credential helper for OS X: git credential-osxkeychain

It is disabled both in the global config file and in the local one, in fact it has never ben enabled. Still, it keeps memorizing my github login details.
I'm on a laptop, so I don't want automatic passwordless access to my repos.
I will use ssh keys. This is a new computer, and the whole system setup is still a work in progress.
For now I used the https repo refs, and the credential helper keeps kicking in.

These are my conf files:


git config --edit =>

[core]     repositoryformatversion = 0     filemode = true     bare = false     logallrefupdates = true     ignorecase = true     precomposeunicode = false [remote "origin"]     url = https://github.com/user/repo.git     fetch = +refs/heads/*:refs/remotes/origin/* [branch "master"]     remote = origin     merge = refs/heads/master [branch "develop"]     remote = origin     merge = refs/heads/develop [branch "deploy"]     remote = origin     merge = refs/heads/deploy 

git config --global --edit =>

[user]     email = ****************     name = tom [color]     ui = true [core]     editor = subl -w [github]     user = tompave [merge]     conflictstyle = diff3 [push]     default = simple 

Also, running git config --global credential.helper returns nothing (and that's right).

However, running git config credential.helper returns osxkeychain!

How is it possible? I can't see it in the local config file, where is it set?

I tried to set it up locally to see what would happen, and it did appear in the repodir/.git/config. Then I deleted the entry... but the helper is still here and active.

I can clearly see its entry in OS X keychain.
I can delete it, and then git will ask for the password again... but as soon as I type it (let's say, for a git fetch), the entry in keychain is restored.

like image 575
tompave Avatar asked Apr 17 '13 05:04

tompave


People also ask

How do I disable credential helper in Git?

Since the credential. helper key is a multi-valued config list, there's no way to "unset" a helper once it's been set. So if your system /etc/gitconfig sets one, you can never avoid running it, but only add your own helpers on top. Since an empty value for credential.

How do I change the credential helper in Git?

To update your credentials, go to Control Panel → Credential Manager → Generic Credentials. Find the credentials related to your Git account and edit them to use the updated password. This should be the accepted answer if git config --list contains credential. helper=wincred .


2 Answers

To help track down the setting, I'd try to use:

git config --local credential.helper git config --global credential.helper git config --system credential.helper 

The first one checks the local repo config, the second is your ~/.gitconfig, and the third is based on where git is installed. Depending on which one comes back showing the credential helper, you can try using the equivalent --unset option:

git config --local --unset credential.helper git config --global --unset credential.helper git config --system --unset credential.helper 

The last one may not work if you don't have proper permissions. So you may need to run the last one under sudo for it to work correctly. FWIW, you may have installed for the pre-built git images for Mac OS X. If you cat /usr/local/git/etc/gitconfig (or /usr/local/etc/gitconfig if you installed git via Homebrew or a building locally), you'll see that it does set up the credential helper for you. So the last command above would help fix that problem.

like image 94
John Szakmeister Avatar answered Sep 17 '22 11:09

John Szakmeister


The other answers were very helpful. The credential.helper didn't show for me in any of the listings (specifying --local, --global, etc) and it always showed on a 'git config -l'. Using the --show-origin command showed that it was coming from an OS X-specific file.

$ git config --show-origin --get credential.helper file:/Applications/Xcode.app/Contents/Developer/usr/share/git-core/gitconfig    osxkeychain 
like image 45
Andrew Goodnough Avatar answered Sep 18 '22 11:09

Andrew Goodnough