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

Go get拉取AWS CodeCommit私有模块失败,求解决方案

问题描述

尝试通过Go模块拉取AWS CodeCommit私有代码库时失败,执行命令:

go get git-codecommit.region.amazonaws.com/version/repo/util_service.git

返回错误:

go: module git-codecommit.region/repos/util_service.git: git ls-remote -q origin in D:\workArea\pkg\mod\cache\vcs\a7336f14e81412deff871e645affca79a601f7: exit status 128:
fatal: unable to connect to git-codecommit.region:
git-codecommit.region[0: 12.34.56.123]: errno=Unknown error

环境信息:Golang 1.20、Windows系统、VSCode编辑器,已尝试相关方案未解决。

解决办法
  • 修正Git的CodeCommit URL映射
    将CodeCommit的旧格式URL映射到正确的v1端点(替换<你的区域>为实际区域,如us-east-1):

    git config --global url."https://git-codecommit.<你的区域>.amazonaws.com/v1/repos/".insteadOf "git-codecommit.<你的区域>.amazonaws.com/version/repo/"
    
  • 验证AWS凭证有效性

    1. 执行aws configure确认Access Key、Secret Key、默认区域配置正确
    2. 检查C:\Users\<你的用户名>\.aws\credentials和C:\Users\<你的用户名>\.aws\config文件是否存在且内容无误
  • 配置Git使用AWS凭证助手
    让Git通过AWS CLI自动处理CodeCommit认证:

    git config --global credential.helper "!aws codecommit credential-helper $@"
    git config --global credential.UseHttpPath true
    
  • 先验证Git连通性
    用Git克隆命令测试仓库是否可访问,排除Go模块的影响:

    git clone https://git-codecommit.<你的区域>.amazonaws.com/v1/repos/util_service
    

    克隆成功后再重新执行go get命令。

  • 排查网络问题

    1. 关闭VPN或代理,尝试直连
    2. 检查Windows防火墙是否允许Git、Go程序访问网络
    3. 执行ping git-codecommit.<你的区域>.amazonaws.com测试端点可达性

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.25 04:02:18