I\'m having trouble adding a folder and all of it\'s subdirectories to my git repository. I realized this is a very popular question after doing some googling and I\'ve trie
I can't say for sure if this is the case, but what appeared to be a problem for me was having .gitignore files in some of the subdirectories. Again, I can't guarantee this, but everything worked after these were deleted.
You can also face problems if a subdirectory itself is a git repository - ie .has a .git directory - check with ls -a
.
To remove go to the subdirectory and rm .git -rf
.
Also struggled, but got it right typing
git add -f ./JS/*
where JS was my folder name which contain sub folders and files
Do,
git add .
while in the root of the repository. It will add everything. If you do git add *
, it will only add the files *
points to. The single dot refers to the directory.
If your directory or file wasn't added to git index/repo after the above command, remember to check if it's marked as ignored by git in .gitignore file.
I saw this problem before, when the (sub)folder I was trying to add had its name begin with "_Something_"
I removed the underscores and it worked. Check to see if your folder has characters which may be causing problems.
Simple solution:
git rm --cached directory
git add directory