1

Recently, I changed the password of my unique Github account online. Since then,everytime I do anything with git on my local machine it keeps asking me for my username and password. I read How do I update the password for Git? and https://help.github.com/articles/updating-your-github-access-credentials/.

The questions Git keeps prompting me for password and git: osxkeychain credential helper silently fails to remember username/password are similar to mine except that I'm not using SSH (or if git does use ssh I am not aware of it. My .ssh directory contains nothing about Github).

I used to have a github item in my Keychain app. As things didn't work, I chose to delete it, and now no new item is created automatically when I enter my username and password in some github operation.

Trying git config --global credential.helper osxkeychain produces the following error

$ git config --global credential.helper osxkeychain
warning: credential.helper has multiple values
error: cannot overwrite multiple values with a single value
       Use a regexp, --add or --replace-all to change credential.helper.

Here is the output of git config -l :

git config -l
credential.helper=osxkeychain
user.name=ewan-delanoy
user.email=<my e-mail here>
push.default=simple
credential.helper=osxkeychain
credential.helper=osxkeychain
credential.helper=osxkeychain
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
core.ignorecase=true
core.precomposeunicode=true
remote.origin.url=https://github.com/ewan-delanoy/Ludlow-Street.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master

UPDATE : as suggested by the current answer, I also give the output of git config -l --show-origin :

file:/usr/local/git/etc/gitconfig   core.excludesfile=~/.gitignore
file:/usr/local/git/etc/gitconfig   core.legacyheaders=false
file:/usr/local/git/etc/gitconfig   core.quotepath=false
file:/usr/local/git/etc/gitconfig   mergetool.keepbackup=true
file:/usr/local/git/etc/gitconfig   push.default=simple
file:/usr/local/git/etc/gitconfig   color.ui=auto
file:/usr/local/git/etc/gitconfig   color.interactive=auto
file:/usr/local/git/etc/gitconfig   repack.usedeltabaseoffset=true
file:/usr/local/git/etc/gitconfig   alias.s=status
file:/usr/local/git/etc/gitconfig   alias.a=!git add . && git status
file:/usr/local/git/etc/gitconfig   alias.au=!git add -u . && git status
file:/usr/local/git/etc/gitconfig   alias.aa=!git add . && git add -u . && git status
file:/usr/local/git/etc/gitconfig   alias.c=commit
file:/usr/local/git/etc/gitconfig   alias.cm=commit -m
file:/usr/local/git/etc/gitconfig   alias.ca=commit --amend
file:/usr/local/git/etc/gitconfig   alias.ac=!git add . && git commit
file:/usr/local/git/etc/gitconfig   alias.acm=!git add . && git commit -m
file:/usr/local/git/etc/gitconfig   alias.l=log --graph --all --pretty=format:'%C(yellow)%h%C(cyan)%d%Creset %s %C(white)- %an, %ar%Creset'
file:/usr/local/git/etc/gitconfig   alias.ll=log --stat --abbrev-commit
file:/usr/local/git/etc/gitconfig   alias.lg=log --color --graph --pretty=format:'%C(bold white)%h%Creset -%C(bold green)%d%Creset %s %C(bold green)(%cr)%Creset %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
file:/usr/local/git/etc/gitconfig   alias.llg=log --color --graph --pretty=format:'%C(bold white)%H %d%Creset%n%s%n%+b%C(bold blue)%an <%ae>%Creset %C(bold green)%cr (%ci)' --abbrev-commit
file:/usr/local/git/etc/gitconfig   alias.d=diff
file:/usr/local/git/etc/gitconfig   alias.master=checkout master
file:/usr/local/git/etc/gitconfig   alias.spull=svn rebase
file:/usr/local/git/etc/gitconfig   alias.spush=svn dcommit
file:/usr/local/git/etc/gitconfig   alias.alias=!git config --list | grep 'alias\.' | sed 's/alias\.\([^=]*\)=\(.*\)/\1\     => \2/' | sort
file:/usr/local/git/etc/gitconfig   include.path=~/.gitcinclude
file:/usr/local/git/etc/gitconfig   include.path=.githubconfig
file:/usr/local/git/etc/gitconfig   include.path=.gitcredential
file:/usr/local/git/etc/gitconfig   diff.exif.textconv=exif
file:/usr/local/git/etc/gitconfig   credential.helper=osxkeychain
file:/Users/ewandelanoy/.gitconfig  user.name=ewan-delanoy
file:/Users/ewandelanoy/.gitconfig  user.email=<my e-mail here>
file:/Users/ewandelanoy/.gitconfig  push.default=simple
file:/Users/ewandelanoy/.gitconfig  credential.helper=osxkeychain
file:.git/config    core.repositoryformatversion=0
file:.git/config    core.filemode=true
file:.git/config    core.bare=false
file:.git/config    core.logallrefupdates=true
file:.git/config    core.ignorecase=true
file:.git/config    core.precomposeunicode=true
file:.git/config    remote.origin.url=https://github.com/ewan-delanoy/Ludlow-Street.git
file:.git/config    remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
file:.git/config    branch.master.remote=origin
file:.git/config    branch.master.merge=refs/heads/master
Ewan Delanoy
  • 1,168
  • 11
  • 25
  • @phd this is not a duplicate of "Reset git template path". I presume you flagged it so because of the "overwrite multiple values" error message, but I have now fixed that as explained in the answer, and the original problem persists. – Ewan Delanoy Jan 23 '18 at 13:18

1 Answers1

2

You can simply edit your global file to leave only one entry:

git config --global --edit

Check also where that setting is set with:

git config -l --show-origin

Then delete your old credentials stored in it.
The next push will ask you again your credentials, but will cache them.

VonC
  • 1,042,979
  • 435
  • 3,649
  • 4,283
  • None of the commands you suggest work. `git config --global --edit credential.helper` raises a `error: wrong number of arguments usage: git config []` error. `git config -l --show-origin` raises a `error: unknown option `show-origin' usage: git config []` error. – Ewan Delanoy Jan 23 '18 at 07:01
  • @EwanDelanoy The first command is actually `git config --global --edit` – VonC Jan 23 '18 at 07:07
  • @EwanDelanoy The second command works provided you have a "recent" (2015!) Git: https://stackoverflow.com/a/34112678/6309 (Git 2.8+) – VonC Jan 23 '18 at 07:10
  • I upgraded my git to 2.15.1 and am now able to run `git config -l --show-origin`, and the output has been appended to my OP. But what am I to do with all that info ? – Ewan Delanoy Jan 23 '18 at 13:13
  • For some reason, the git command to erase the old credentials (that would be `git credential-osxkeychain erase host=github.com protocol=https`) fails by getting stuck without returing control (for more than 5 min). – Ewan Delanoy Jan 23 '18 at 13:15
  • On the other hand, I was able to succesfully edit my .gitconfig file : the "multiple values" error message has now disappeared – Ewan Delanoy Jan 23 '18 at 13:20
  • @EwanDelanoy The goal was to make sure no other "credential.helper" config was present in some other setting file (and `git config -l --show-origin` does show you those files) – VonC Jan 23 '18 at 13:30
  • As for your non-responsive command, maybe https://stackoverflow.com/q/38979625/6309 could help? – VonC Jan 23 '18 at 13:32
  • Both the original question and the comments on this answer are becoming not very readable by going into too many directions at once, I'll make a brand new question out of the current status of the problem. I accept this answer not because you solved the problem but because you brought some help – Ewan Delanoy Jan 23 '18 at 14:24