After using "eb deploy" integrated to source control the CodeCommit remote repo is updated (I can see in AWS Console that the commit is there, in the cloud repo) and the EC2 instance is correctly running the new deployed version (can see it also through AWS Console).
The problem: all things are synced but GIT says the remote repo is one commit behind it is actually is.
When I type "git status" it says: Your branch is ahead of 'codecommit-origin/master' by 1 commit. (use "git push" to publish your local commits)
When I type "git log codecommit-origin/master" is does not show the last commit.
Why is GIT saying my local repo is ahead of remote when clearly in the AWS Console the remote CodeCommit repo is up-to-date? Could be that "eb deploy" pushing to CodeCommit is not actually a "git push" command?
When you are doing eb init, and when you come to this part:
you should answer no (N). That way, eb won't make another origin (codecommit-origin).
I do it whis way:
1. git clone from CodeCommit repo.
2. eb init without CodeCommit.
3. create branch (eg. development, git branch development).
4. eb use development-env
5. eb deploy
I actually have "re-run" the command eb init -i going through the setup again and it worked:
Then I run git status and git log codecommit-origin/master and things are correctly synced now:
$ git status
On branch master
Your branch is up-to-date with 'codecommit-origin/master'.
nothing to commit, working directory clean
The EB CLI is doing an
git push
under the hood but it builds its own credentials to do that push instead of using the aws git credential helper.Although the CLI will still setup the HTTPS credentials specified in the documentation in the AWS Documentation.
The fact that your local git repository is out of sync is because the EB CLI runs it's git actions using a separate method than you would running them in your command line. You can use the command
git fetch
to sync your local branch with the remote to get the most up-to-date status fromgit status
.If you are using OSX there is a known issue with the Keychain Access utility and the workaround is specified in section 3.3 of the link I provided.