fatal: Not a git repository: '.git' error

浪子不回头ぞ 提交于 2019-11-30 18:17:58
VonC

In doubt, in your hook, set up explicitly git-dir and work-tree parameters:

git --git-dir .git --work-tree . add ...

You can even put the full path to be extra-sure:

git --git-dir D:/xampp/htdocs/app/application/.git --work-tree D:/xampp/htdocs/app/application/. add ...

That way, you rule out any environment issue with those git-dir or work-tree stuck into another path which isn't the one of the repo your are cd'ing into.
See "Calling 'git pull' from a git post-update hook" for an example of that problem.

i had the exact same issue like you and found this solution:

instead of doing

cd D:/xampp/htdocs/app/application
git add [database].sql

i simply did

git add D:/xampp/htdocs/app/application/[database].sql

that way i didn't irritate git by cd-ing into another folder :)

make sure you're in directory which have .git folder ? to make sure, try to run

git status

and see what's happen. if you still get such message, I think your git hasn't been set up yet.

follow those steps to set up it:

git init
git add .
git commit -m "your message"
git push
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!