"Commit failed - exit code 1 received" when trying to commit a new local reprository in gihub desktop
Regarding:
Check first if you have added files to your index.
Open the command line and check your git status
.
Second, see desktop/desktop issue 3701:
some users have run into this error due to having nested
.git
directories.
Can you try searching your repository to see if you have multiple.git
directories?Had a
.git
in my repository (which I needed) and a.git
in a subfolder (which I deleted), then it worked.
Finally, check if you have any submodule (a .gitmodules
file at the root of your repo).
See desktop/desktop issue 1770.
If I commit changes in submodule myself than GitHub Desktop is able to push and/or commit changes after that. After submodule is committed manually SHA1 changes from dirty. At this point I can commit to main repo.
I removed the repository from GitHub Desktop (not from the disk) and then added it again as a local repository and this solved the issue for me.
I was receiving this error as well, but unlike others I did not have have any nested .git folders. When trying to view changes, each of the files appeared as "empty" until I removed the repository from GitHub Desktop and added it again.
I encountered the same thing and it's caused by .git in subfolder.
Just removed all related .git files and the error disappeared.