I use Windows 10. Before installing git 2.6.1.windows.1
, I installed git 1.9.5.github.0
(by installing GitHub Desktop), it works fine. But when I installed git 2.6.1.windows.1
(from git-scm.com ), I can no longer use git:
The powershell console displays [(unknown)]
instead [master]
, even when I changed the working directory to my project, it still displays[(unknown)]
When I git add
(or git commit
, git push
), he told me a mistake:fatal: Not a git repository: 'C:\Program Files\Git'
After that, I will return to the old version of git - git 1.9.5.github.0
but the error is still there.
I think git has not changed the working directory, I have no idea. Now I can not work with git.
How to fix it?
EDIT 1:
Again, this is not the first time I use git, I never forget cd myproject
. However, although I switched to the project, git "thought" it worked in C:\Program Files\Git
and did not "understand" that the working directory was changed! What's the problem, Like the title: Git does not change the working directory
EDIT 2:
When Get-Command git
in powershell, it returns:
CommandType Name Version Source
----------- ---- ------- ------
Application git.exe 2.6.0.0 C:\Program Files\Git\cmd\git.exe
EDIT 3:
@EdwardThomson asked me to withdraw git config --list
andGet-ChildItem Env:
DECIDE:
, GIT_DIR
, , ! - GIT_DIR
, GIT_DIR
, git
, , git
, .