I've initialized a new git repo, and done git init
then git add .
, and it still shows all the files in the directory as untracked files when I do git status
. It just lists the main directory in untracked files and none of the files in the folder.
I've tried doing git add --all ./
also with no change. I've also tried deleting my .gitignore file and running git add .
again, to see if maybe it was blocking too much with no change (other than .gitignore no longer being an untracked file, since it's gone). I've also checked for .git folders in all the parent directories of this one to make sure I'm not within another repository.
Here's output from git status
:
On branch master
Initial commit
Untracked files:
.gitignore
README.md
apprentice/
data-access/
nothing added to commit but untracked files present
Also, I can get .gitignore and README.md to stage by typing git add <filename>
where is either .gitignore or README.md. That doesn't work on either of the two directories though, and I'm primarily interested in committing the files in the directories. I would expect git add .
to pick up both files and the directories and their contents.
If you want to rule out any gitignore rule, type:
cd /path/to/my/repo
git check-ignore -v -- apprentice/aFile_which_should_be_added
You will see immediately if there is a .gitignore (local or global) rule preventing any file to be added.
Try also to add a file directly:
git add apprentice/aFile_which_should_be_added
Compare it with:
git add -f apprentice/aFile_which_should_be_added
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.