Bitbucket使用GCM报错:sec_free断言失败(Ubuntu 20.04)
解决Ubuntu 20.04下Git Credential Manager操作Bitbucket私有仓库的断言失败问题
针对你遇到的Bitbucket操作时GCM触发git-credential-manager: egg/egg-secure-memory.c:596: sec_free: Assertion cell->requested > 0' failed. Aborted (core dumped)报错,且Github正常的问题,可尝试以下几种解决方法:
清除现有Bitbucket凭据
执行命令触发凭据清除:git credential-manager erase按提示依次输入:
- 协议:
https - 主机:
bitbucket.org - 用户名:你的Bitbucket用户名
回车完成清除后,重新执行克隆/推送操作,此时输入Bitbucket的App Password(若开启2FA,必须用App Password替代登录密码)。
- 协议:
升级/降级Git Credential Manager版本
该断言错误多为特定版本GCM的bug,Ubuntu 20.04默认版本可能存在兼容性问题:- 卸载现有版本:
sudo apt remove git-credential-manager-core - 添加微软官方软件源并安装最新稳定版:
curl -sSL https://packages.microsoft.com/config/ubuntu/20.04/prod.list | sudo tee /etc/apt/sources.list.d/microsoft-prod.list curl -sSL https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add - sudo apt update && sudo apt install git-credential-manager-core
安装完成后重新测试Bitbucket仓库操作。
- 卸载现有版本:
临时切换凭据存储方式
若上述方法无效,可临时改用Git内置的凭据存储(仅作测试,不建议长期使用):git config --global credential.helper 'store'重新执行操作并输入App Password,凭据会明文存储在
~/.git-credentials文件中。如需换回GCM,执行:git config --global credential.helper '/usr/share/git-credential-manager-core/git-credential-manager-core'检查Bitbucket App Password权限
确认你使用的App Password已勾选足够权限:至少需要「Repository read」「Repository write」权限,若涉及其他操作(如项目管理)需对应勾选,权限不足也可能导致凭据验证异常。
内容的提问来源于stack exchange,提问作者João Vítor Café
相关产品推荐
相关产品推荐

