yves
yves

Reputation: 15

git/GitHub Desktop not recognizing files in subfolders

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)

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)

Upvotes: 0

Views: 3892

Answers (3)

mkhodroo
mkhodroo

Reputation: 11

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.

Upvotes: 1

st_phan
st_phan

Reputation: 904

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}

Upvotes: 3

Roberto Vallejo
Roberto Vallejo

Reputation: 19

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

Upvotes: 1

Related Questions