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

使用AWS SSO后Poetry无法拉取AWS CodeCommit中的Git依赖

解决方案

1. 确认git-remote-codecommit安装与AWS SSO状态

  • 先确保git-remote-codecommit工具已安装:
    pip install git-remote-codecommit
    
  • 验证AWS SSO登录有效,确保当前有可用凭证:
    aws sso login --profile my_profile
    
    这里的my_profile是你在~/.aws/config里配置的SSO专属profile名称。

2. 修正pyproject.toml的依赖配置

使用codecommit协议时必须明确区域和仓库名,正确格式如下:

[tool.poetry.dependencies]
python = "^3.10"
pandas = "^2.0.3"
mylib = {git = "codecommit://my_profile@eu-central-1/mylib"}

注意:不需要加.git后缀,区域要和你的CodeCommit仓库所在区域一致(比如示例里的eu-central-1)。

3. 确保Git关联AWS SSO凭证

  • 在~/.gitconfig里添加或确认以下配置,让Git调用AWS CLI获取SSO凭证:
    [credential "https://git-codecommit.*.amazonaws.com"]
      helper = !aws codecommit credential-helper $@
      UseHttpPath = true
    
  • 清理旧的CodeCommit凭证缓存,避免冲突:
    git credential-cache exit
    
    也可以手动删除系统凭据存储里的旧CodeCommit条目(比如Mac钥匙串、Windows凭据管理器)。

4. 先验证Git拉取是否正常

跳过Poetry,直接用Git拉取仓库,确认连接没问题:

git clone codecommit://my_profile@eu-central-1/mylib

如果这一步成功,再重新运行Poetry安装命令:

poetry install

5. 排查Poetry的Git环境问题

如果前面都没问题,可能是Poetry没使用系统Git配置,执行以下命令调整:

poetry config experimental.system-git-client true

之后再重新执行poetry install。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.12 13:10:01