You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Mac下需认证的Git操作失效:git pull/push无响应无凭证提示

Git拉取/推送阻塞无凭证请求问题(Mac环境)

问题详情

  • 设备:Mac
  • 异常表现:执行git pull或git push时终端卡住无响应,未弹出凭证输入窗口;git commit功能正常
  • 已排查操作:卸载并重新安装Git,问题未解决
  • 追踪日志:执行GIT_TRACE=1 git pull得到以下输出:
10:45:57.431007 git.c:460               trace: built-in: git pull
10:45:57.435625 run-command.c:655       trace: run_command: git fetch --update-head-ok
10:45:57.442808 git.c:460               trace: built-in: git fetch --update-head-ok
10:45:57.448499 run-command.c:655       trace: run_command: GIT_DIR=.git git remote-https origin repositoryName
10:45:57.454243 git.c:750               trace: exec: git-remote-https origin repositoryName
10:45:57.454664 run-command.c:655       trace: run_command: git-remote-https origin repositoryName
10:45:57.675229 run-command.c:655       trace: run_command: '/usr/local/share/gcm-core/git-credential-manager-core get'

解决方案

1. 临时禁用凭证管理器测试

从日志看,Git卡在了调用git-credential-manager-core get步骤,先临时禁用凭证助手:

git config --global --unset credential.helper

执行后再尝试git pull,看是否会弹出凭证输入提示。

2. 修复Git Credential Manager Core

如果禁用后正常,说明是GCM Core的配置问题:

  • 重置GCM Core配置:
git-credential-manager-core configure
  • 若重置无效,重新安装GCM Core(通过Homebrew):
brew reinstall git-credential-manager-core

3. 手动指定凭证格式

修改远程仓库URL为带用户名的格式,强制手动输入凭证:

git remote set-url origin https://你的用户名@仓库地址.git

执行git pull后按提示输入密码或个人访问令牌(若仓库启用双因素认证,需用访问令牌代替密码)

内容的提问来源于stack exchange,提问作者kaidan094

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.13 07:41:36