【发布时间】:2018-07-01 20:51:56
【问题描述】:
最近,我在网上更改了我唯一的 Github 帐户的密码。从那以后,每次我在本地机器上使用 git 做任何事情时,它都会不断询问我的用户名和密码。我读过How do I update the password for Git? 和https://help.github.com/articles/updating-your-github-access-credentials/。
Git keeps prompting me for password 和 git: osxkeychain credential helper silently fails to remember username/password 的问题与我的问题相似,只是我没有使用 SSH(或者如果 git 确实使用 ssh,我不知道。我的 .ssh 目录中没有任何关于 Github 的内容)。
我曾经在我的 Keychain 应用程序中有一个 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\.\([^=]*\)=\(.*\)/\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
【问题讨论】:
-
@phd 这不是“重置 git 模板路径”的副本。我认为您之所以标记它是因为“覆盖多个值”错误消息,但我现在已按照答案中的说明修复了该问题,并且原始问题仍然存在。
标签: git macos github ssh keychain