14

I'm getting started with the ElasticBeanstalk AWS CLI and I've changed some of my workflow around. Previously I deployed from a directory above my git repository (which is a clone of a private GitLab directory), and shifted things around.

Before it was structured like this:

-- some_dir
 |-- .ebextensions
 | |- some_files 
 |
 |-- my_git_directory
   |- .git 
   |- some_files 

And when I run eb deploy:

[some_dir] $ eb deploy
... Everything is awesome.

But now, I've moved to try and deploy from the git directory, but things aren't working:

-- some_dir
 |-- my_git_directory
   |-- .ebextensions
   | |- some_files 
   |- .git 
   |- some_files 

[some_dir/my_git_directory] $ eb deploy
... Everything sucks.
ERROR: An error occurred while handling git command.
Error code: 128 Error: fatal: Not a git repository (or any of the parent directories): .git

Now its all busted, and deploy no longer works. I've tried adding a branch and deploying a staged version:

$ eb branch
usage: eb (sub-commands ...) [options ...] {arguments ...}
eb: error: unrecognized arguments: branch

$ eb deploy
ERROR: This branch does not have a default environment. 
You must either specify an environment by typing "deploy my-env-name" or set a default environment by typing "eb use my-env-name".
$ eb use  django-env2

$ eb deploy --staged
... Nope, still busted
John Rotenstein
  • 241,921
  • 22
  • 380
  • 470

1 Answers1

42

So I got it solved and it is surprisingly basic, but it might help others.

If you move where you are deploying from you need to re-initialise something (not sure what), and it was fixed by running:

eb init

Then everything worked fine again.

  • 2
    Wow. Such a simple solution for such a mind-boggling problem. Thanks a million. – SaryAssad Nov 22 '17 at 07:02
  • This is very helpful, thnaks. – Arefe Sep 04 '21 at 05:03
  • This solved my 403 error on eb create! ERROR: CommandError - An error occurred while handling git command. Error code: 128 Error: fatal: unable to access {my codecommit repo} The requested URL returned error: 403 – newspire Oct 14 '21 at 14:58