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

Git在Eclipse正常工作但Git Bash拉取GitLab仓库报403错误求助

问题:Git在Eclipse正常但Git Bash拉取仓库报403错误

我通过用户名+访问令牌访问GitLab仓库,Eclipse执行git pull能正常返回everything up to date,但Git Bash执行同一命令时返回403错误:

fatal: unable to access 'https://gitlab.xxxx.it/xxxxxx/xxxxx/xxxxxx.git/': The requested URL returned error: 403

以下是我的Git配置列表:

$ git config --list
diff.astextplain.textconv=astextplain
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
http.sslbackend=openssl
http.sslcainfo=C:/Program Files/Git/mingw64/etc/ssl/certs/ca-bundle.crt
core.autocrlf=true
core.fscache=true
core.symlinks=true
core.editor="C:\\Program Files\\Notepad++\\notepad++.exe" -multiInst -notabbar -nosession -noPlugin
pull.rebase=false
credential.helper=manager
credential.https://dev.azure.com.usehttppath=true
init.defaultbranch=master
user.name=giovanni.difronzo
user.email=giovanni.difronzo@xxxx.it
http.sslbackend=schannel
http.sslverify=false
pack.deltacachesize=2047m
pack.packsizelimit=2047m
pack.windowmemory=2047m
pack.window=1
core.packedgitlimit=512m
core.packedgitwindowsize=512m
core.compression=0
difftool.sourcetree.cmd=''
mergetool.sourcetree.cmd=''
mergetool.sourcetree.trustexitcode=true
credential.helper=manager
core.symlinks=false
core.repositoryformatversion=0
core.filemode=false
core.logallrefupdates=true
remote.origin.url=https://gitlab.xxxxx.it/xxxx/xxxx/xxxxx.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master
branch.master.rebase=false
branch.develop.remote=origin
branch.develop.merge=refs/heads/develop
branch.develop.rebase=false

排查建议

  • 检查系统凭据存储:打开Windows凭据管理器,查找对应GitLab仓库的凭据条目,确认用户名是你的GitLab账号,密码为访问令牌。若没有则手动添加。
  • 直接在URL中嵌入令牌测试:执行命令git pull https://<你的用户名>:<访问令牌>@gitlab.xxxxx.it/xxxx/xxxx/xxxxx.git,如果成功,说明凭据管理器未正确加载令牌。
  • 重置凭据助手:运行git config --global credential.helper manager-core,重新执行git pull,在弹出的凭据框中输入用户名和访问令牌。
  • 清理冲突配置:配置中credential.helper=manager重复出现,且http.sslbackend同时设置了openssl和schannel,执行git config --global --unset http.sslbackend保留一个有效值,避免配置冲突。
  • 验证令牌权限:确认GitLab访问令牌拥有read_repository权限,若缺失则前往GitLab账号设置更新令牌权限。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.17 17:05:58