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

AWS Cloud9推送代码至CodeCommit时遇403权限错误求助

问题描述

尝试将本地代码推送到AWS CodeCommit仓库时,出现403错误:

fatal: unable to access 'https://git-codecommit.us-east-1.amazonaws.com/v1/repos/theme-park-frontend/': The requested URL returned error: 403

附带截图:
教程参考图
Cloud9报错截图

尚未尝试任何解决方案。

解决步骤

1. 检查IAM权限

  • 确保当前使用的IAM用户/角色拥有CodeCommitFullAccess权限,或自定义策略包含codecommit:GitPull、codecommit:GitPush权限,且策略关联目标仓库资源(格式:arn:aws:codecommit:us-east-1:你的AWS账户ID:theme-park-frontend)。

2. 配置Git凭据助手

  • 在Cloud9环境中执行以下命令,确保Git使用AWS凭据助手访问CodeCommit:
    git config --global credential.helper '!aws codecommit credential-helper $@'
    git config --global credential.UseHttpPath true
    
  • 运行aws configure list确认当前AWS CLI配置的区域为us-east-1,账户ID与CodeCommit仓库所属账户一致。

3. 验证远程仓库URL

  • 执行git remote -v检查远程仓库URL是否正确,若有误,运行以下命令更新:
    git remote set-url origin https://git-codecommit.us-east-1.amazonaws.com/v1/repos/theme-park-frontend
    

4. 确认网络访问权限

  • 若Cloud9环境在VPC内,需确保VPC已配置CodeCommit的VPC端点(服务名:com.amazonaws.us-east-1.codecommit),或安全组、NACL允许出站HTTPS(443端口)流量访问公网。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.26 22:52:06