简体   繁体   English

AWS CodeCommit - 致命:未找到存储库“https://git-codecommit.us-east-1..”

[英]AWS CodeCommit - fatal: repository 'https://git-codecommit.us-east-1..' not found

I have an AWS account.我有一个 AWS 账户。 I created a repository in us-east-1 region.我在 us-east-1 区域创建了一个存储库。 When I try to access it from my Mac's terminal I get an error fatal: repository 'https://git-codecommit.us-east-1.amazonaws.com/v1/repos/demo/' not found .当我尝试从 Mac 的终端访问它时,我收到一个fatal: repository 'https://git-codecommit.us-east-1.amazonaws.com/v1/repos/demo/' not found错误fatal: repository 'https://git-codecommit.us-east-1.amazonaws.com/v1/repos/demo/' not found I was able to access this repository using SourceTree GIT client.我能够使用 SourceTree GIT 客户端访问这个存储库。

I create another repository in California region and I was able to access that repository from the terminal itself.我在加利福尼亚地区创建了另一个存储库,并且能够从终端本身访问该存储库。

Why my Mac's terminal can't find repositories in a particular AWS region?为什么我的 Mac 终端找不到特定 AWS 区域的存储库?

I followed the link that both VonC and Uzair mentioned and I was able to get to the CLI git command to work after just entering:我按照 VonC 和 Uzair 提到的链接进行操作,并且在输入后我就可以使用 CLI git 命令来工作:

git config --global credential.UseHttpPath true

Thanks VonC.谢谢 VonC。 PS: Make sure you have a current version of git installed. PS:确保您安装了当前版本的 git。 CodeCommit supports Git versions 1.7.9 and later. CodeCommit 支持 Git 版本 1.7.9 及更高版本。

If you are using AWS profiles, then adding credential helper without profile, will use the default profile of your AWS CLI setup.如果您使用 AWS 配置文件,则添加不带配置文件的凭证助手将使用您的 AWS CLI 设置的默认配置文件。 To make sure you are using the same profile/AWS account where your CodeCommit repository is located, you need to specify profile in credential-helper use like this:为确保您使用的是 CodeCommit 存储库所在的相同配置文件/AWS 账户,您需要在credential-helper使用中指定配置文件,如下所示:

git config --global credential.helper '!aws --profile HERE_YOUR_CLI_PROFILE_NAME codecommit credential-helper $@'

Use the following commands使用以下命令

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

Check if SourceTree has a Git config different from your Git command line: this answer points out to setting:检查 SourceTree 的 Git 配置是否与您的 Git 命令行不同:此答案指出设置:

[credential]
helper = /usr/local/bin/aws codecommit credential-helper $@
UseHttpPath = true

Ie: The credential helper for AWS might not have been set for that particular repository in command line, while the Git used by SourceTree (which can be an embedded one) would be correctly set.即: AWS凭证助手可能没有在命令行中为该特定存储库设置,而 SourceTree 使用的 Git(可以是嵌入式的)将被正确设置。

I agree with first trying out VonC's suggestion above.我同意首先尝试上面 VonC 的建议。 Here's the link for setting up the credential helper for further reference:这是设置凭证助手的链接以供进一步参考:

https://docs.aws.amazon.com/codecommit/latest/userguide/setting-up-https-unixes.html#setting-up-https-unixes-credential-helper https://docs.aws.amazon.com/codecommit/latest/userguide/setting-up-https-unixes.html#setting-up-https-unixes-credential-helper

Watch out: this error can be returned even if the repository is found, but the credentials provided are not correct.注意:即使找到存储库,也会返回此错误,但提供的凭据不正确。

In my case, since i have 2 aws accounts, i was using profile A to access account of profile B, and this gave me this error.就我而言,由于我有 2 个 aws 帐户,因此我使用配置文件 A 访问配置文件 B 的帐户,这给了我这个错误。

If you have used a CodeCommit repository in another AWS account the credentials for the first account can be cached on your computer, and as a result git is looking for the CodeCommit repo in the first account.如果您在另一个 AWS 账户中使用了 CodeCommit 存储库,则第一个账户的凭证可以缓存在您的计算机上,因此 git 会在第一个账户中寻找 CodeCommit 存储库。

To solve this in Windows open Credential Manager (hit start, type credential), find your cached credentials, then delete them.要在 Windows 中解决此问题,请打开凭据管理器(点击开始,键入凭据),找到缓存的凭据,然后将其删除。 It's also possible that the git credential manager or another credential manager is being used, which is worth investigating if credentials aren't in the windows credential manager.也可能正在使用 git 凭据管理器或其他凭据管理器,如果凭据不在 Windows 凭据管理器中,则值得调查。

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

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