I'm going to start off by saying that I'm not particularly good with either git or Windows. However, I've been successfully using msysgit on Windows 7 for a while now, keeping track of a number of different repositories using the Git GUI.

For some reason, though, when I try to navigate to any of the directories that have my repositories and run git status from PowerShell, I get the following error:

fatal: Not a git repository (or any of the parent directories): .git

I'm not exactly sure why this is happening, as I can cd to this directory:


However, I'm pretty sure it has something to do with the fact that my %HOME% environment variable is set to C:\Users\wilduck\. My thought that this is the problem is supported by the fact that if I perform the following commands:

mkdir C:\Users\wilduck\stupidtest
cd C:\Users\wilduck\stupidtest
git init

A git repository is initialized in C:\Users\wilduck, not in the stupidtest subdirectory.

So, my problem is that, while I can work in a few different repositories using the Git GUI, I cannot access those repositories from PowerShell. I've thought about re-installing msysgit, as I'm not sure which option I chose for "How would you like to run git from the command line", but I have no idea if that will affect my ability to get at my existing repositories. I've also thought about changing my %HOME% environment variable each time that I want to work in a different repository but that is both a pain, and screws with the .gitconfig settings.

My basic question can be easily written as How do I get git, from PowerShell, to recognize my existing repositories? However, I have a number of related questions that I would love some explanation for:

  1. Why does this work fine with Git GUI, but not with powershell? Is there some magic going on behind the scenes?
  2. Is this an artifact of how windows environment variables work? Or how git handles a home directory?
  3. Did I, at any point, screw something up terribly?

Make sure $Env:GIT* are empty, or removed. http://git-scm.com/blog/2010/04/11/environment.html explains what each one does.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.