git not adding existing folder

前端 未结 2 1634
暗喜
暗喜 2021-01-05 15:56

I started working on a project recently, then decided to push it up to github. So I did the following:

cd 
git init
git add -A
git commit -m \'me         


        
相关标签:
2条回答
  • 2021-01-05 16:25

    A subfolder will not be added with git add . (or similar commands) if it contains a .git dir because it will be assumed to be a git submodule.

    You can rm -rf .git in the subfolder if it's not supposed to be a submodule.

    0 讨论(0)
  • 2021-01-05 16:28

    Are there files in the folder? Git doesn't track folders, only files; you can't add an empty folder to a Git repo. However, you can put an empty file in that folder (.gitignore or .blank are common file names) and add those files to the folder.

    0 讨论(0)
提交回复
热议问题