我可以在目录中提交单个文件,但它不允许我提交整个目录。
答案 0 :(得分:4)
您需要在该文件夹中git commit
才能正常工作
你需要先添加它
这不会起作用:
git init test
git add test
git commit -m "add test"
这样可行:
git init test
cd test
git add .
git commit -m "add test"
您可以检查文件夹是否为part of a repo:
cd test
git rev-parse --git-dir
确保没有定义像GIT_DIR
这样的环境变量(这会使git命令在其他地方查找git repo)