amazon-web-services - 在 PyCharm 中的何处配置我的 AWS“代码提交”凭证?[Elastic Beanstalk 代码管道]
问题描述
我正在通过 PyCharm 的代码提交将带有 Amazon RDS PostgreSQL db 的 Python/Django 应用程序部署/推送(GitHub)到 AWS Elastic Beanstalk。
我上传了我的服务器证书(有 SSL 问题,大多数人可以忽略 --no-verify-ssl):
aws iam upload-server-certificate --server-certificate-name CSC --certificate-body file://public.pem --private-key file://private.pem --no-verify-ssl
等工作正常。
eb init设置代码提交,SSH:
Do you wish to continue with CodeCommit? (y/N) (default is n): y
Enter Repository Name
(default is "origin"):
Successfully created repository: origin
Enter Branch Name
***** Must have at least one commit to create a new branch with CodeCommit *****
(default is "master"):
Username for 'https://github.com/mygitusername/myapp.git': user@email.com
Password for 'https://user@email.com@github.com/mygitusername/myapp.git':
Successfully created branch: master
Do you want to set up SSH for your instances?
(Y/n): y
Select a keypair.
1) mykeypairname
...
工作得很好。
eb 创建安装环境等。
Enter Environment Name
(default is eb-myapp-dev):
Enter DNS CNAME prefix
(default is eb-myapp-dev):
Select a load balancer type
1) classic
2) application
3) network
(default is 2):
Would you like to enable Spot Fleet requests for this environment?
(y/N): n
Starting environment deployment via CodeCommit
...
工作得很好。
然后我去 PyCharm 提交更改,然后推入 Git,我被要求提供我的代码提交“凭据”。我想,我的 AWS 访问密钥 ID 和密钥?我通过aws configure
这些使用/确认是准确的。也许可以,但有一个“密码助手”选项,所以我点击它。现在我无法返回该屏幕输入我的凭据,或者至少尝试一下。我不断得到:
Push failed
Unable to access 'https://git-codecommit.us-east-1.amazonaws.com/v1/repos/origin/': The requested URL returned error: 403
如何在 PyCharm 中配置我的 AWS“代码提交”凭证?
解决方案
原始海报,在这里。这是我解决问题的方法。
- 运行以下命令将 AWS 凭证帮助程序添加到 ~/.gitconfig:
git config --global credential.helper '!aws codecommit credential-helper $@' credential.UseHttpPath true
git config --global credential.helper '!aws --profile CodeCommitProfile codecommit credential-helper $@'
- 运行 git
config --global --edit
以验证您的输入。 - 打开钥匙串。在用户名中添加“+” git-codecommit.us-east-2.amazonaws.com和您的访问密钥 ID,在密码中添加密钥。保存并关闭。
- 删除您刚刚在钥匙串中为git-codecommit.us-east-2.amazonaws.com创建的规则。
- Git 设置为在 macOS 上使用 Keychain Access 实用程序,这可能会导致 Amazon Code Commit 服务出现问题。通过运行以下命令来更改它:
git config --system --unset credential.helper
您应该得到类似的东西:“不存在价值”或“已删除”。
- 最后,我遵循了这些 AWSCodeCommitPowerUser 说明:https ://docs.aws.amazon.com/codecommit/latest/userguide/setting-up-gc.html#setting-up-gc-account 。
我不确定其中哪一个真正解决了我的问题,但毕竟,我打开了 PyCharm 并执行了提交/推送。现在它起作用了。
推荐阅读
- android - 设置 AlarmManager 以随机间隔重复
- python - '>' 在 Django 中的 'QuerySet' 和 'int' 实例之间不支持
- python - Pycharm:解包的值太多
- xcode - Pod 文件丢失
- computer-vision - 为什么边缘检测滤波器总和为 0,而模糊滤波器总和为 1?
- c++ - 如何在 C++ linux 中将系统调用转换为 fork
- android - Xamarin android 显示来自外部存储的图像
- parameters - 邮递员:有没有办法在正文中的一个参数内重新生成参数
- pandas - pandas - 在另一个 DF 中查找一个值,而不合并来自另一个数据帧的数据
- node.js - 我应该怎么做对于异步测试和钩子,确保调用“done()”;如果返回一个 Promise,确保它解决