首页 > 解决方案 > 在 AWS 中使用 Codepipeline 时遇到的错误

问题描述

我正在创建一个源为 Codecommit 的管道,并使用 CodePipeline 将 CodeCommit 存储库中维护的代码部署到单个 Amazon EC2 实例。当您将更改推送到 CodeCommit 存储库时会触发您的管道。

但是在执行管道时,我面临以下错误:-

Invalid action configuration
The action failed because no branch named master was found in the selected AWS CodeCommit repository MyDemoRepo. Make sure you are using the correct branch name, and then try again. Error: null

你能帮我解决这个问题吗?

标签: amazon-web-servicesaws-codepipeline

解决方案


默认情况下,当您通过控制台或 CLI [1] 在 CodeCommit 中创建存储库时,不会创建任何分支,这可以使用以下命令进行确认:

$ git ls-remote https://git-codecommit.us-east-1.amazonaws.com/v1/repos/MyDemoRepo

请推送一些代码:

$ git clone https://git-codecommit.us-east-1.amazonaws.com/v1/repos/MyDemoRepo
$ touch a.txt
$ git checkout -b  master
$ git add .
$ git commit -m "Initial Commit"
$ git push

[1] https://docs.aws.amazon.com/cli/latest/reference/codecommit/create-repository.html


推荐阅读