0

Neither git nor GitHub Desktop seem to recognize the changes that I have in subfolders of any folder i try to add to a repo. I'm just trying to make a new GitHub Pages site: so it's recognizing the files in the parent folder fine (folder name: username.github.io), but when i clone a theme into the username.github.io/themes/themename directory, it doesn't pick up anything there.

Strangely, I also tried to commit a set of folders with files, and this is what happened:

Parent Folder(repository)

  • subfolder A: files
  • subfolder B: files + another subfolder

It recognized all the files from subfolder A, but nothing from subfolder B, except that it was there--but it only recognized it as "empty."


I've tried deleting and re-making the repository a few times. There's no .gitignore in either folder.

Here's the error message I get when I try to commit the files that it is recognizing. It's also saying all of these files are empty, and they are not.

On branch master

Initial commit

Untracked files:
  (use "git add <file>..." to include in what will be committed)
    ./

nothing added to commit but untracked files present (use "git add" to track)
yves
  • 15
  • 6
  • What happens when you actually `add` the files? `./` indicates you are in the directory that is not yet tracked, thus it will grab everything inside of it, without listing its contents – mnestorov Jun 22 '21 at 17:37
  • forgot to mention you, @mnestorov. when i `add` it still doesn't recognize all the files but i was able to commit the changes it did recognize. – yves Jun 22 '21 at 18:33

3 Answers3

2

In my case I accidentally had a repository in the subfolder (due to create-react-app):

(This also made Github Desktop display the subfolder with the repository show up as a file)

/repository-folder/.git
/repository-folder/.gitattributes
/repository-folder/{everything else}
/repository-folder/subfolder/.git
/repository-folder/subfolder/.gitattributes
/repository-folder/subfolder/{everything else}

Solution: I just deleted the git files and everything worked as expected:

/repository-folder/.git
/repository-folder/.gitattributes
/repository-folder/{everything else}
/repository-folder/subfolder/{everything else}
st_phan
  • 715
  • 9
  • 23
1

Assuming this is a new repo you just initialized, you might need to add the new folder/files first:

in the root directory:

git add . 

or you can also try to add the specific folder:

git add A
  • forgot to add that i've tried this, it hasn't done anything for me unfortunately. when i checked `git status` it did say that `themes` was untracked, but when i added it it just added the "empty" folder, then it recognized the `themename` subdirectory, but nothing else in there beyond that. – yves Jun 22 '21 at 17:59
  • 1
    @yves: if the sub-folder is itself a Git repository, `git add` will add it as a *submodule*. A Git repository *cannot* contain another Git repository (it's forbidden as it would lead to huge security issues). Note that `git add` doesn't record everything correctly and probably should just complain, rather than creating an improperly-created submodule. In any *modern* Git it will complain *and* create the improperly-created submodule, but you may be using an ancient Git version. – torek Jun 22 '21 at 19:52
  • Unless the previous comment has guided you to a solution, perhaps this other answer can be helpful, specifically the --force option: https://stackoverflow.com/questions/10859632/git-add-still-nothing-to-commit-with-new-files – Roberto Vallejo Jun 23 '21 at 00:12
0

According to st_phan's answer, in Windows, the .git folder is hidden in subfolders. First, enable the display of hidden files in Windows, then delete the .git folder from subfolders.