简体   繁体   English

通过HTTP克隆AWS Codecommit存储库

[英]clone AWS codecommit repo via HTTP

I have set 2 repositories in AWS Codecommit and using before SourceTree from Windows, setting up access via HTTP protocol was and everything was working fine. 我在AWS Codecommit中设置了2个存储库,并且在使用Windows的SourceTree之前使用过,通过HTTP协议设置访问权限,一切都工作正常。

Right not I am migrating the development of a project on a machine where I do have installed ubuntu and where I choose to use gitkraken. 是的,不是,我正在已安装ubuntu并选择使用gitkraken的计算机上迁移项目的开发。

I was able to git clone in a folder where my user has read and write access(my user) via Terminal, so isn't permission related in Ubuntu, where after git clone "aws repo url" I was prompt asking for the username for the IAM and password(the one created at AWS IAM console). 我能够在用户通过终端读写访问权限的文件夹中进行git clone,因此与Ubuntu中的权限无关,在git clone“ aws repo url”之后,我被提示要求输入用户名IAM和密码(在AWS IAM控制台上创建的一个)。

I can of course open that repo folder from gitkraken and see even all the remote branch and all the history, but once I do for example pull from gitkraken it failed as "access" denied. 我当然可以从gitkraken打开该repo文件夹,甚至可以查看所有远程分支和所有历史记录,但是例如一旦我从gitkraken中拉出,它就因为“访问”被拒绝而失败了。 I cannot also clone the same or another repo from Gitkraken. 我也无法从Gitkraken复制相同或另一个仓库。 So seems I do have to configure my credentials in gitkraken but not sure where that should be done. 所以似乎我必须在gitkraken中配置我的凭据,但不确定应该在哪里进行。 This official doc does not say much. 这个官方文档并没有说太多。

I actually found that I was able to connect, and previously I was failing because not following some steps quite hide in the AWS Codecommit docs: 我实际上发现我能够连接,并且以前失败了,因为未遵循某些步骤就完全隐藏在AWS Codecommit文档中:

I am not sure if giving the following at prompt are necessary steps, but I guess they do not hurt: 我不确定在提示时提供以下内容是否是必要的步骤,但我想它们不会对您造成伤害:

At terminal provide the following: 在终端上提供以下内容:

aws configure

you will be prompt to provide: 您将被提示提供:

AWS Access Key ID AWS访问密钥ID

AWS Secret Access Key AWS秘密访问密钥

Default region name 默认区域名称

Default output format 默认输出格式

Till here I do recommend to provide the above 直到这里,我建议您提供以上内容

After on clone "your https AWS address" your_repo_name, you are prompted to provide an username and a password. 在克隆“您的https AWS地址” your_repo_name之后,系统将提示您提供用户名和密码。 Unfortunately for both my root account and my IAM account(with correct rules policy) I got 403 error. 不幸的是,对于我的root帐户和IAM帐户(使用正确的规则策略),我都收到403错误。

What was successful, without provide additional credential was to execute at terminal the following: 没有提供额外证书的成功做法是在终端执行以下操作:

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

then simply: 然后简单地:

clone https://your_url_code your_repo_name for HTTPS connection from AWS Codecommit console

For more detailed instruction refer to the official docs 有关更详细的说明,请参阅官方文档

This worked for me. 这对我有用。

Carmine! 胭脂红!

I'm really sorry to hear that you have connection issues with CodeCommit. 得知您与CodeCommit存在连接问题,我感到非常抱歉。

You can try to setup a SSH connection following this docs: https://docs.aws.amazon.com/codecommit/latest/userguide/setting-up-ssh-unixes.html . 您可以按照以下文档尝试设置SSH连接: https : //docs.aws.amazon.com/codecommit/latest/userguide/setting-up-ssh-unixes.html

After that, open the repository with Gitkraken. 之后,使用Gitkraken打开存储库。 When you try to pull or push, Gitkrake will ask you for credentials. 当您尝试拉动或推动时,Gitkrake会要求您提供凭据。 Use the ssh credentials created on the previous step. 使用上一步创建的ssh凭据。

If Gitkraken fails again, check the file .git/config inside your local copy of the repository. 如果Gitkraken再次失败,请检查存储库本地副本中的.git / config文件。 I've noticed that the url created was incorrect, so check that the generated url matches the following pattern: 我注意到创建的网址不正确,因此请检查生成的网址是否符合以下格式:

[remote "origin"]
url = ssh://<Your-SSH-Key-ID>@git-codecommit.<region>.amazonaws.com/v1/repos/<repo-name>
fetch = +refs/heads/*:refs/remotes/origin/*

While trying to clone aws repository to your local folder, make sure that region code of repository and default region code specified in your local aws CLI configure is same. 尝试将aws存储库克隆到本地文件夹时,请确保存储库的区域代码和本地aws CLI配置中指定的默认区域代码相同。 Otherwise, it will give an error. 否则,将产生错误。

fatal: unable to access ' https://git-codecommit.us-east-1.amazonaws.com/v1/repos/coderepo/ ': The requested URL returned error: 403 致命:无法访问' https://git-codecommit.us-east-1.amazonaws.com/v1/repos/coderepo/ ':请求的URL返回错误:403

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

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