Github 不缓存我的密码

Github doesn't cache my password

最近,我在线更改了我唯一的 Github 帐户的密码。从那以后,每次我在本地机器上使用 git 做任何事情时,它都会不断询问我的用户名和密码。我读 How do I update the password for Git? and https://help.github.com/articles/updating-your-github-access-credentials/

问题 Git keeps prompting me for password and 与我的类似,只是我没有使用 SSH(或者如果 git 确实使用了 ssh 我不知道。我的 .ssh 目录不包含任何关于 Github).

我的钥匙串应用程序中曾经有一个 github 项目。由于事情不起作用,我选择删除 它,现在当我在某些 github 操作中输入我的用户名和密码时,不会自动创建新项目。

尝试 git config --global credential.helper osxkeychain 会产生以下错误

$ 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.

这是 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 :根据当前答案的建议,我还给出了 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\.\([^=]*\)=\(.*\)/\     => /' | 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

您可以简单地编辑全局文件以仅保留一个条目:

git config --global --edit

同时检查 设置的设置:

git config -l --show-origin

然后delete your old credentials stored in it.
下一次推送将再次询问您的凭据,但会缓存它们。