CodeCommit fails when after commit rewrite with --amend

2.6k views Asked by At

We are using AWS Elastic Beanstalk and eb cli for deployment.

One problem we stumbled upon is not being able to rewrite commits.

When trying to deploy with eb deploy after runnig git commit --amend , we get the following error:

ERROR: InvalidParameterValueError - "Error making request to CodeCommit: Could not retrieve 0fb2ddf61003f05e67aeabe... (Service: AWSCodeCommit; Status Code: 400; Error Code: CommitIdDoesNotExistException; Request ID: bee56acc-201b-4a3f-...-...)"

How can we overcome that and deploy after running git commit --amend ?

SOLUTION:

eb codesource local, to disable CodeCommit integration.

Apparently CodeCommit was strangely partially integrated. It was performing some sort of tracking - thus the error, but when running eb use --source codecommit/myrepo/mybranch it was failing:

ERROR: NotFoundError - CodeCommit branch not found:

Anyone who can shed some more light on the subject would be welcome.

2

There are 2 answers

4
VonC On BEST ANSWER

Reading "Configuring additional branches and environments ", and considering any amend will rewrite the history (at least change the HEAD commit), you might noeed to:

  • force push
  • re-specify the branch source to use for eb environment

That is:

git push --force
eb use --source my-app/myBranch <eb-environment>

The OP Gapi reports actually having to desactivate codecommit:

eb codesource local
0
Arpit On

In your terminal use

eb codesource local
eb create <env name>