繁体   English   中英

AWS Codecommit - 致命:无法访问:请求的 URL 返回错误:403

[英]AWS Codecommit - fatal: unable to access : The requested URL returned error: 403

在重新安装aws-cli之前,我能够从我的 AWS CodeCommit 存储库中提取和/或推送更新。 我尝试了所有我能找到的建议解决方案,但似乎没有任何效果。

我正在使用 Ubuntu 21.10 并安装:

$ aws --v
  aws-cli/1.19.1 Python/3.9.7 Linux/5.13.0-41-generic botocore/1.20.0

git version 2.32.0

我得到的错误是:

fatal: unable to access 'https://git-codecommit.eu-west-2.amazonaws.com/v1/repos/myrepo/': The requested URL returned error: 403

它曾经询问我的用户名和密码,但在我尝试解决问题后,它不再完全询问我的凭据。 无论哪种方式,我都确认我使用的是正确的凭据。 此外,我在 AWS 确实拥有必要的权限。 直到几个小时前,我才成功地拉动和推送更新。

aws credential helper 按照大多数在线解决方案的建议进行设置。 更具体地说,我的.gitconfig文件如下所示:

[user]
    name = My_name
    email = My_email
[credential]
    helper = !aws codecommit credential-helper $@
    UseHttpPath = true

此外,我正确地(使用正确的区域)设置了$ aws configure配置。

清单$ git config --list --show-origin我得到:

file:/etc/gitconfig     user.email=My_email
file:/home/f_user/.gitconfig user.name=My_name
file:/home/f_user/.gitconfig user.email=My_email
file:/home/f_user/.gitconfig credential.helper=!aws codecommit credential-helper $@
file:/home/f_user/.gitconfig credential.usehttppath=true

老实说,我不知道还能尝试什么,任何帮助将不胜感激!

编辑:我解决问题的方法是:

  • 从我的系统中卸载 aws 客户端并从头开始重新安装和配置它。
  • 我克隆了我的 IAM 账户并为其提供了完整的 AWSCodeCommit 访问权限。

我不确定解决它的部分是什么,可能是第一步。

如果您使用 Mac go 进行钥匙串访问,请查找代码提交并删除存储的密钥。

仔细检查 CodeCommit 的AWS 托管策略
如果您的IAM 用户已切换到ForceMultiFactorAuthentication作为策略,您将需要使用令牌,而不是您的密码。

在本地,检查您的凭证管理器存储的密码:

printf "protocol=https\nhost=git-codecommit.eu-west-2.amazonaws.com"|aws codecommit credential-helper get

毕竟我解决问题的方法是:

Uninstalled aws client from my system and re installed and configured it from scratch.
I cloned my IAM account and gave it Full AWSCodeCommit access.

我不确定解决它的部分是什么,这可能是我重新安装所有内容后的第一步,再次提示我使用我的凭据。

只需如下删除凭据,下次弹出窗口提示输入凭据 删除凭据管理器的步骤

控制面板 选择“通用凭据”下的“凭据管理器”,删除相应的 Git 凭据。

我的解决方案是重新安装 git 并取消选择 git 凭证助手。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM