我的本地笔记本电脑是Mac。
Host barthea
Hostname git-codecommit.us-east-1.amazonaws.com
User AVVVVVVVVVVVVVVVVVQ
IdentityFile ~/.ssh/aws-aws.pem
跑ssh barthea得到了我
`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.我创建了一个带有密码和访问密钥的IAM用户bruce666,使该用户成为“团队”组的一部分。然后我创建了一个包含“AWSCodeCommitPowerUsers”的策略,并将此策略分配给“团队”。最后将bruce666分配给“团队”。此时,bruce666可以通过管理控制台访问CodeCommit中的任何仓库。
This helpful text is found on the AWS documentation for codecommit and Windows integration
如果您安装的Git for Windows包含Git凭据管理器实用程序,则在前几次连接尝试后,您将看到403错误或提示以向凭证管理器实用程序提供凭据。解决此问题的最可靠方法是在没有Git凭据管理器实用程序选项的情况下卸载然后重新安装Git for Windows,因为它与AWS CodeCommit不兼容。
如果要保留Git Credential Manager实用程序,则必须执行其他配置步骤以使用AWS CodeCommit,包括手动修改.gitconfig文件以指定在连接到AWS CodeCommit时使用AWS CodeCommit的凭据帮助程序。
从Credential Manager实用程序中删除所有存储的凭据(您可以在“控制面板”中找到此实用程序)。
删除任何存储的凭据后,将以下内容添加到.gitconfig文件中,保存,然后再尝试从新的命令提示符窗口再次连接:
[credential "https://git-codecommit.us-east-1.amazonaws.com"]
helper = !aws codecommit credential-helper $@
UseHttpPath = true
此外,在所有连接按预期工作之前,您可能必须通过指定--system而不是--global或--local来重新配置git配置设置。
最后一部分适用于我的情况,虽然当我运行git config --system它没有按预期运行但在aws codecommit命令之前附加了aws configure。
所以我不得不在git中运行它来查找系统配置文件的位置。
git config --list --show-origin
然后我将建议的部分从AWS添加到我的c:/users/username/.gitconfig和我的c:/ ProgramData / Git / config文件中。
在那个git push开始工作之后 - 即使我在我的回复之前得到了错误
"git: 'credential-aws' is not a git command. See 'git --help'."
对我来说,获取错误的根本原因是无论我在OSX上使用哪个版本的git,GIT总是从文件中获取使用osxkeychain的credential.helper配置:
/Applications/Xcode.app/Contents/Developer/usr/share/git-core/gitconfig
摆脱这个解决了我的问题,并没有打破任何东西。
我解决了
403错误消息是一个特定的Git错误消息。我添加了两个AWS指定的帮助程序命令:
git config --global credential.helper '!aws --profile bruce666 codecommit credential-helper $@'
git config --global credentials.helper UseHttpPath=true
并解决了这个问题。
本地目录中的.git / config文件(在克隆刚刚创建的Codecommit存储库之前,应该如下所示:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = false
[credential]
helper = !aws --profile bruce666 codecommit credential-helper $@
UseHttpPath = true
[remote "origin"]
url = https://git-codecommit.us-east-1.amazonaws.com/v1/repos/barthea
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
如.git / config文件中所指定,您使用https而不是ssh进行克隆。我一定不能使用OSX附带的默认版本的git,因为我没有遇到任何工具链问题。
我在OSX中的情况。
第一步:
git config --global credential.helper '!aws codecommit credential-helper $@'
git config --global credentials.helper UseHttpPath=true
但是,验证git config --list --show-origin
file:/usr/local/etc/gitconfig credential.https://git-codecommit.eu-west-1.amazonaws.com.helper=!aws codecommit credential-helper $@
file:/usr/local/etc/gitconfig credential.helper=osxkeychain
file:/Users/mine/.gitconfig user.name=my-user
file:/Users/mine/.gitconfig [email protected]
file:/Users/mine/.gitconfig filter.lfs.clean=git-lfs clean -- %f
file:/Users/mine/.gitconfig filter.lfs.smudge=git-lfs smudge -- %f
file:/Users/mine/.gitconfig filter.lfs.process=git-lfs filter-process
file:/Users/mine/.gitconfig filter.lfs.required=true
file:/Users/mine/.gitconfig credential.helper=!aws codecommit credential-helper $@
file:/Users/mine/.gitconfig credential.usehttppath=true
第一行之前没有出现,git正在使用osxkeychain
优先。因此,我不得不做git config --system ...
cat /usr/local/etc/gitconfig
[credential "https://git-codecommit.eu-west-1.amazonaws.com"]
helper = !aws codecommit credential-helper $@
UseHttpPath = true
[credential]
helper = osxkeychain
因此,指定了URL以便在存储其他凭据的情况下进行回退。
更新https://docs.aws.amazon.com/codecommit/latest/userguide/troubleshooting-ch.html
出于某种原因,有时似乎没有添加UseHttpPath = true。所以它可以(应该)添加在[凭证]下
致命:无法访问'https://git-codecommit.yourregion.amazonaws.com/v1/yourrepositoryname/':请求的URL返回错误:403
它发生在以下地区
codecommitfullaccess
政策。配置
以下解决方案适用于在Windows 10上使用Git Bash的少数开发人员。
如果在“连接到存储库”选项卡上选择Windows作为操作系统,则命令的格式如下:
git config --global credential.helper "!aws codecommit credential-helper $@"
git config --global credential.UseHttpPath true
但是,如果您使用Git Bash,请选择“Linux,MacOS或Unix”选项。请注意第一行上的单引号而不是双引号。
git config --global credential.helper '!aws codecommit credential-helper $@'
git config --global credential.UseHttpPath true
祝你好运。
提到:https://forums.aws.amazon.com/thread.jspa?threadID=198356发布者:mwhardesty