AWS CodeCommit错误:git:'credential-aws'不是git命令。

27
我是Amazon Web Services的新手,正在为我工作的公司实施持续交付
我按照AWS的[配置CodeCommit服务的说明](http://docs.aws.amazon.com/codecommit/latest/userguide/setting-up-https-windows.html#setting-up-https-windows-account)进行操作。 步骤1:AWS CodeCommit的初始配置 创建和配置IAM用户以访问AWS CodeCommit: 我创建了一个新的IAM用户,并给他授予AWSCodeCommitFullAccess

安装和配置AWS CLI:

我使用aws configure进行了凭证的安装和配置。 将AWS访问密钥ID、AWS秘密访问密钥、默认区域名称设置为us-east-1de

步骤2:安装Git 我安装了Git For Windows,并确保清除了“启用Git凭据管理器”选项。

步骤3:设置凭证助手

git config --global credential.helper "!aws codecommit credential-helper $@"
git config --global credential.UseHttpPath true

执行中:
git config --global --edit

我的配置是:

[http]
  sslVerify = false
[credential]<br> 
  helper = "aws codecommit list-repositories codecommit credential-helper "
  UseHttpPath = true

步骤四:连接到 AWS CodeCommit控制台并克隆存储库。
    $ git clone https://git-codecommit.us-east-1.amazonaws.com/v1/repos/teste-git-to-s3<br>
    Cloning into 'teste-git-to-s3'...<br>
    git: 'credential-aws' is not a git command. See 'git --help'.<br>
    Username for 'https://git-codecommit.us-east-1.amazonaws.com/v1/repos/teste-git-to-s3': Lucas<br>
    fatal: unable to access 'https://git-codecommit.us-east-1.amazonaws.com/v1/repos/teste-git-to-s3/': The requested URL returned error: 403

我在寻找AWS故障排除时发现:Troubleshooting AWS CodeCommit,但我无法解决问题。

这个问题应该如何解决?

3个回答

29

我认为问题在于您的.gitconfig文件中。将其更改为以下内容,应该就可以解决了。

[credential]    
    helper = !aws codecommit credential-helper $@ 
    UseHttpPath = true  

顺便提一下,如果您使用的是 Bash 模拟器而不是 Windows 命令行,则必须使用单引号而不是双引号。

如果这样不起作用,请告诉我。


1
打开命令提示符并使用Git运行git config,指定使用带有AWS凭据配置文件的Git凭据助手,从而使Git凭据助手能够发送到存储库的路径:git config --global credential.helper "!aws codecommit credential-helper $@"如果您使用的是Bash仿真器而不是Windows命令行,则必须使用单引号而不是双引号。http://docs.aws.amazon.com/codecommit/latest/userguide/setting-up-https-windows.html#setting-up-https-windows-credential-helper - shrimpwagon
我使用ZSH,我遇到了同样的问题。 - emurano

0
如果您正在使用cygwin,在创建存储库后,单击连接信息按钮,选择Linux而不是Windows,它可以正常工作。

0

我在使用Python 3.8.x时遇到了这个问题 - 确保你使用的是文档中显示的Python 3.7.x版本


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接