aws 代码提交未提供凭据提示

问题描述

我(错误地)在克隆 AWS CodeCommit 存储库时输入了无效的代码提交凭证,现在 git clone https://git-codecommit.us-east.... 出现 443 错误并且不提示输入用户名

在一次尝试失败后,提示似乎已被禁用,请帮助我如何再次启用它。

我试过了:

git clone https://usenmae@git-codecommit.........

也一样,但即使这样也行不通

我使用以下方法设置了用户名

git config --local user.name <myuser>

但即使这样也行不通

解决方法

我猜您已经使用以下方法设置记住 https 凭据:

git config --global credential.helper store

您可以在 ~/.gitconfig 中更改凭据。或者,您可以unset 使用帮助程序:

git config --global credential.helper unset

或者,您可以在 git clone 中明确提供用户名和凭据:

git clone https://<git-user-from-iam>:<git-pass-from-iam>@git-codecommit.....
,

将这些行放入您的 ~/.gitconfig 并保存:

[credential "https://git-codecommit.*.amazonaws.com"]
    helper = !aws codecommit credential-helper $@ 
    UseHttpPath = true

然后关闭并打开命令行(git bash)的新窗口,并确保您使用的 URL 如下:https://git-codecommit.*.amazonaws.com 没有用户名和密码。您可以在这里阅读:1

如果它不起作用,请尝试取消设置 config-credentials 并重试。这对我有用:https://docs.aws.amazon.com/codecommit/latest/userguide/troubleshooting-gc.html

git config --global --unset credential.helper