针对AWS CodeCommits运行git clone给我一个403错误 [英] running git clone against AWS CodeCommits gets me a 403 error

查看:600
本文介绍了针对AWS CodeCommits运行git clone给我一个403错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的本​​地笔记本电脑是Mac。


  1. ssh密钥配置正确。这就是〜/ .ssh / config

    的内容

    主机barthea
    主机名git-codecommit.us-east-1.amazonaws .com
    用户AVVVVVVVVVVVVVVVVVVQQ
    IdentityFile〜/ .ssh / aws-aws.pem


运行ssh barthea可以使我

 `您已经通过SSH成功​​进行了身份验证。您可以使用Git与AWS CodeCommit进行交互。不支持交互式shell。与git-codecommit.us-east-1.amazonaws.com的连接已由远程主机关闭。 

`
2.我创建了一个带有密码和访问密钥的IAM用户bruce666,然后创建一个包含 AWSCodeCommitPowerUsers的策略,并将该策略分配给 team。最终将bruce666分配给团队。此时,bruce666可以通过管理控制台访问CodeCommit中的任何存储库。


  1. 我运行了 aws config --profile bruce666 ,输入他的访问和密钥,他的区域并在json中指定格式。此时,我能够通过运行 aws codecommit get-repository --repository-name rekha --profile bruce666


  2. 在CodeCommmit中创建rekha repo
  3. 我可以创建几个虚拟文件,运行 git init git add。 git commit -m 1 git添加来源


    1. 选择'git-codecommit ....',然后按Delete

    2. 确认删除。

    现在再试一次。它应该工作。遇到错误403时,您可能下次也必须再次执行此操作。



    此问题的可能原因之一是钥匙串密码与登录密码不同您的MAC。


    My local laptop is a Mac.

    1. The ssh key is configured properly. This is the content of ~/.ssh/config

      Host barthea Hostname git-codecommit.us-east-1.amazonaws.com User AVVVVVVVVVVVVVVVVVQ IdentityFile ~/.ssh/aws-aws.pem

    Running ssh barthea gets me

    `You have successfully authenticated over SSH. You can use Git to interact with AWS CodeCommit. Interactive shells are not supported.Connection to git-codecommit.us-east-1.amazonaws.com closed by remote host.
    

    ` 2. I created an IAM user bruce666 complete with password and access keys, made this user part of the "team" group.Then I created a policy that includes "AWSCodeCommitPowerUsers" and assigned this policy to "team". And finally assigned bruce666 to "team". At this point, bruce666 can access any repo in CodeCommit through the management console.

    1. I ran aws config --profile bruce666, fed in his access and secret key, his region and specified the format at json. At this point, I was able to create the rekha repo in CodeCommmit by running aws codecommit get-repository --repository-name rekha --profile bruce666

    2. I can create a couple of dummy files, run git init, git add . , git commit -m "1", git add origin https://git-gitcode.amzonaws.com/repos/v1/rekha , git push -u origin master And that operation will be successful.

    3. However, when I run git clone ssh://git-gitcode.amazonaws.com/repos/v1/rekha , I get "fatal: unable to access 'https://git-codecommit.us-east-1.amazonaws.com/v1/repos/barthia/': The requested URL returned error: 403" What gives?

    解决方案

    On MAC, if above-mentioned tricks don't work, do the following:

    1. Open Keychain Access
    2. Search for CodeCommit. You should find this:

    1. Select 'git-codecommit....' and press delete
    2. Confirm the delete.

    Now try again. It should work. You may have to do it again next time as well when you face the error 403.

    One of the possible reason for this issue is the keychain password different than login password on your MAC.

    这篇关于针对AWS CodeCommits运行git clone给我一个403错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆