【问题标题】:Mac: git is broken - credential issueMac:git 坏了 - 凭证问题
【发布时间】:2021-01-31 01:01:12
【问题描述】:

当我尝试使用 git 从命令行获取某些内容时,我得到:

"git: 'credential-git' is not a git command. See 'git --help'.
remote: Invalid username or password."

知道 credential-git 存储在哪里吗? Sourcetree 和其他客户端也无法正常工作。

这是我的 git 配置:

credential.helper=osxkeychain
user.name=My Name
user.email=my@email.com
core.excludesfile=/Users/oge/.gitignore_global
difftool.sourcetree.cmd=opendiff "$LOCAL" "$REMOTE"
difftool.sourcetree.path=
mergetool.sourcetree.cmd=/Applications/Sourcetree.app/Contents/Resources/opendiff-w.sh "$LOCAL" "$REMOTE" -ancestor "$BASE" -merge "$MERGED"
mergetool.sourcetree.trustexitcode=true
commit.template=/Users/myuser/.stCommitMsg
url.https://api:@github.com/.insteadof=https://github.com/
url.https://ssh:@github.com/.insteadof=ssh://git@github.com/
url.https://git:@github.com/.insteadof=git@github.com:
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
credential.https://dev.azure.com.usehttppath=true
credential.helper=manager-core
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true

【问题讨论】:

  • 您已将credential.helper 配置为git,但您没有credential-git。为什么你首先将credential.helper 配置为git

标签: git macos


【解决方案1】:

this question 中所示,对于 MacOS,凭据帮助程序应设置为 osxkeychain

git config --global credential.helper osxkeychain

然后您可以按照 GitHub 在“Updating credentials from the macOS Keychain”中的说明使用它。

作为torekmentioned,任何凭证助手值都会促使Git 执行可执行文件git-credential-xxx。对于 Mac Git 发行版,这将是 git-credential-osxkeychain

【讨论】:

  • 设置凭证助手,钥匙串中的密码正确,但我仍然收到身份验证错误。我在哪里设置访问令牌?
  • @netshark1000 如果您使用的不是 HTTPS URL,而是 SSH URL,就会发生这种情况。或者您正在使用 HTTPS URL,但使用密码而不是个人访问令牌。 (docs.github.com/en/free-pro-team@latest/github/…
  • 我用令牌替换了钥匙串中的所有 GitHub 条目。 (回购是通过 https 获取的)。但还是一样。使用 GitHub 桌面时,它会要求提供凭据,但也会因密码或令牌而失败。我在另一台 Mac 上没有问题。
  • @netshark1000 你能检查一下更新 Git 和使用 Credential Manager Core (git config --global credential.helper manager-core) 是否有帮助吗? github.com/microsoft/…
  • 现在我得到 git: 'credential-manager-core' 不是 git 命令。请参阅“git --help”。尝试克隆时
猜你喜欢
  • 1970-01-01
  • 2011-03-26
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-09-12
  • 1970-01-01
相关资源
最近更新 更多