Git add error - error: 'main/' does not have a commit checked out

I am trying to push a rails 6 app to heroku. I am following these steps:

  1. git init
  2. git add .
  3. git commit -m “My first commit”
  4. heroku create
  5. git push heroku master

when I run command: git add . I get this error:
git add .
error: ‘main/’ does not have a commit checked out
fatal: adding files failed

Any suggestions would be greatly appreciated!

1 Like

hi, I’m also new with git and have the same problem, did you solve it? thank you …

Im having the same exact error. any news of how to fix ?

There may be directory called Main, If you can find directory called Main , there may be .git folder hidden into it.

If there is nothing else in Main directory, you may try deleting it and then re-run commands.

Hopefully it should work

1 Like