7

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:

Error

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

KernelPanic
  • 211
  • 1
  • 3
  • 9

4 Answers4

9

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.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
1

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

src folder is symlink in windows

GitHub not allowing symlink to commit

David Refoua
  • 3,476
  • 3
  • 31
  • 55
0

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.

rookie mistake

I just had to delete this folder.

Jordan Nakamoto
  • 251
  • 2
  • 4
0

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).

PolarisTLX
  • 329
  • 4
  • 18