You will often face this issue when the Git crashes unexpectedly. Now to resolve this issue you need to go to your hidden .git directory shown in the error message and you need to delete the index.lock file located there.
You will need to enable the viewing hidden files and folders on Windows.
To access the log files you need to go to the file menu in GitHub Desktop and select Help > Show Logs in Finder (for macOS) or Explorer (for Windows). The log files are created daily.
For those are using Unix/Mac/etc
In your terminal when you are at project root just delete it manually if you can't see it use following command:
rm -rf ./.git/index.lock
After deleting the index.lock file you can do commit using GitHub Desktop again.