gitamazon-web-servicesamazon-elastic-beanstalkaws-codecommitebcli

CodeCommit fails when after commit rewrite with --amend


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.


Solution

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

    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