Why is my git commit invalid?

Question

I tried committing my changes and the terminal returned an error saying Valid Git commands start with the word "git" followed by a space, then the command name., how can I fix this?

Answer

If you see this error, it may be a temporary environment issue that can be resolved with a restart. In that case, try pressing ‘Get Help’ in the bottom right and then restarting. If the issue persists, try the following:

  1. Make sure you’re using Chrome
  2. Clear your browser cache
  3. Hard refresh the page (Cmd + Shift + R on Mac, Ctrl + F5 on Windows)

If you’re still seeing the same error, be sure you actually did commit correctly!
A passing commit would look like: git commit -m "Complete first line of dialogue"

9 Likes

what is the -m there for exactly? just curious.

It’s a shortcut command option for git commit --message which is used to attach a message to the commit (rather than open the editor or otherwise). Check git commit --help or the docs if you wanted more information about the options for git commit.

3 Likes