From GitHub Desktop Team:
Some users have run into this error due to having nested .git directories. Please try searching your repository to see if you have multiple .git directories.
For most users, the above solution should work. If that doesn't work then check if you have added files to your index. You can do that using the command line — basically check your git status.
If you commit changes in sub-module then GitHub Desktop is able to push and/or commit changes after that. After sub-module is committed manually SHA1 changes from dirty. At this point I can commit to main repo.
Sometimes, you might not have any nested .git folders. You can just remove the repo from GitHub Desktop and add it again. You only need to remove it from GitHub and not from your hard drive.
There are few other solutions available on the GitHub's issues page. Good luck!
app code commit error github solution