GitHub keeps throwing “Could not commit submodules” error, and I don't see why that is. Any ideas?

匿名 (未验证) 提交于 2019-12-03 03:06:01

问题:

I'm trying to put my project on GitHub, but I keep running into an issue. I made a repo on GitHub (the website), downloaded the client, cloned (dragged and dropped the link GitHub gave me basically) it in, moved my project in the clone directory, and I still didn't see the files. So I checked under "Changes", and found my project files. Now it's saying "Could not commit submodules". How do I fix this?

Here's a screenshot if anyone needs it:

Due to being too long here is the log in its entirety.

回答1:

If your project was itself a git repo (meaning it has a .git), the presence of the .git could confuse the GitHub Desktop client.
It could be seen as a nested git repo (for which only the gitlink is recorded), and the GUI tries to see it as a submodule.

Try with command line (unzip PortableGit-2.6.3-64-bit.7z.exe anywhere you want and add it to your %PATH%)

cd /your/project git remote add origin https://github.com/<username>/<yourrepo> git push 

Then reference that same project directory in GitHub Desktop: it will be recognized as a local repo linked to a GitHub one.


Update 2018, as mentioned by t3chb0t in the comments:

The new client desktop.github.com doesn't have this problem anymore.



回答2:

For me, it was because the mentioned folder was a symlink in Windows.



回答3:

I encountered this error for a different reason.

Being a novice programmer, I had used Github Desktop to accidentally create a repo within my repo.

I just had to delete this folder.



回答4:

What worked simplest for me when I had the same issue was to just delete the duplicates of the .git files and .git folder.

The main project parent folder should have 2 files (.git and .gitignore) + a folder called .git (it may be a hidden folder)

I had these files duplicated in the next subfolder, which confused Github Desktop. So I just deleted all the duplicated instances of these files that were in the subfolder(s).



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!