title: Git bash always says the branch is ((unknown)) in all directories
body: <p>Something very strange happened to GIT on my Windows 7 machine recently. Using GIT bash, if I change to <em>any</em> directory on any hard drive on my computer, I see:</p>
  
  <pre><code>Adam@C-ADAM ~ ((unknown))
  </code></pre>
  
  <p>Where the <code>~</code> is variable depending on the current directory.</p>
  
  <p>If I run <code>git status</code> I get the following output:</p>
  
  <pre><code>flashplayerpluginfatal: Not a git repository (or any of the parent directories):
  .git
  </code></pre>
  
  <p>The clue must be in the <code>flashplayerplugin</code>, however, I've searched for this folder on my computer and I cannot find anything relating to <code>.git</code>. </p>
  
  <p>If I navigate to an actual GIT repository directory on my computer I get:</p>
  
  <pre><code>Adam@C-ADAM /d/WWW/yii-projects/irish-health-pro (flashplayerpluginrefs/heads/ma
  ster)
  </code></pre>
  
  <p>My other guess is that some directory in my <code>$PATH</code> variable might contain a <code>.git</code> directory.  However, I've been through these and I cannot find anything obvious:</p>
  
  <pre><code>$ echo $PATH
  /c/Users/Adam/bin:.:/usr/local/bin:/mingw/bin:/bin:/c/Python27/:/c/Python27/Scri
  pts:/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/c/Program Files/Comm
  on Files/Microsoft Shared/Windows Live:/c/Windows/system32:/c/Windows:/c/Windows
  /System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0/:/c/EXEs:/c/Program Fi
  les (x86)/Microsoft SQL Server/100/Tools/Binn/:/c/Program Files/Microsoft SQL Se
  rver/100/Tools/Binn/:/c/Program Files/Microsoft SQL Server/100/DTS/Binn/:/c/xamp
  p/apache/bin:/c/xampp/mysql/bin:/c/Program Files (x86)/cwRsync/bin:/c/EXEs:/c/EX
  Es/ffmpeg/bin:/c/EXEs/gource:/c/xampp/php:/c/Program Files (x86)/QuickTime/QTSys
  tem/:/c/Users/Adam/AppData/Roaming/Python/Scripts:/c/Program Files/Common Files/
  Microsoft Shared/Windows Live
  </code></pre>
  
  <p>I've reinstalled GIT, but it makes no difference. </p>
  
  <p>If I run git gui from any folder I get:</p>
  
  <p><img src="https://i.stack.imgur.com/VcnMd.jpg" alt="git gui fatal error"></p>
  
  <p>Has anyone seen something like this before and knows how to resolve? I cannot use Git at all on this computer any more and I'm desperate to get some work done this weekend!</p>
  
  <h1>Edit</h1>
  
  <p>As requested:</p>
  
  <pre><code>$ cd; set -x
  ++ __git_ps1
  ++ local pcmode=no
  ++ local detached=no
  ++ local 'ps1pc_start=\u@\h:\w '
  ++ local 'ps1pc_end=\$ '
  ++ local 'printf_format= (%s)'
  ++ case "$#" in
  ++ printf_format=' (%s)'
  +++ __gitdir
  +++ '[' -z '' ']'
  +++ '[' -n '' ']'
  +++ '[' -n '' ']'
  +++ '[' -d .git ']'
  +++ git rev-parse --git-dir
  ++ local g=flashplayerplugin
  ++ '[' -z flashplayerplugin ']'
  ++ local r=
  ++ local b=
  ++ '[' -f flashplayerplugin/rebase-merge/interactive ']'
  ++ '[' -d flashplayerplugin/rebase-merge ']'
  ++ '[' -d flashplayerplugin/rebase-apply ']'
  ++ '[' -f flashplayerplugin/MERGE_HEAD ']'
  ++ '[' -f flashplayerplugin/CHERRY_PICK_HEAD ']'
  ++ '[' -f flashplayerplugin/BISECT_LOG ']'
  +++ git symbolic-ref HEAD
  ++ b=flashplayerplugin
  ++ detached=yes
  ++ b=flashplayerplugin
  +++ cut -c1-7 flashplayerplugin/HEAD
  ++ b=...
  ++ b=unknown
  ++ b='(unknown)'
  ++ local w=
  ++ local i=
  ++ local s=
  ++ local u=
  ++ local c=
  ++ local p=
  +++ git rev-parse --is-inside-git-dir
  ++ '[' true = flashplayerplugin ']'
  +++ git rev-parse --is-inside-work-tree
  ++ '[' true = flashplayerplugin ']'
  ++ local f=
  ++ '[' no = yes ']'
  ++ printf -- ' (%s)' '(unknown)'
  </code></pre>
  
  <h1>Edit</h1>
  
  <p>Adding more info as requested:</p>
  
  <pre><code>Adam@C-ADAM ~ ((unknown))
  $ set | grep -F GIT
                              case "${GIT_PS1_DESCRIBE_STYLE-}" in
              b="GIT_DIR!";
              if [ -n "${GIT_PS1_SHOWDIRTYSTATE-}" ]; then
              if [ -n "${GIT_PS1_SHOWSTASHSTATE-}" ]; then
              if [ -n "${GIT_PS1_SHOWUNTRACKEDFILES-}" ]; then
              if [ -n "${GIT_PS1_SHOWUPSTREAM-}" ]; then
          if [ -n "${GIT_PS1_SHOWCOLORHINTS-}" ]; then
              GIT_PS1_SHOWUPSTREAM="$value";
              if [[ -z "${GIT_PS1_SHOWUPSTREAM}" ]]; then
  for option in ${GIT_PS1_SHOWUPSTREAM};
                  upstream=${GIT_SVN_ID:-git-svn};
          if [ -n "${GIT_DIR-}" ]; then
              test -d "${GIT_DIR-}" || return 1;
              echo "$GIT_DIR";
  Adam@C-ADAM ~ ((unknown))
  $ cat ~/.gitconfig
  [user]
      name = Adam xxxx
      email = adamxxxx@gmail.com
  [diff]
      tool = bc3
  [difftool "bc3"]
      path = c:/program files (x86)/beyond compare 3/bcomp.exe
  [merge]
      tool = bc3
  [mergetool "bc3"]
      path = c:/program files (x86)/beyond compare 3/bcomp.exe
  Adam@C-ADAM ~ ((unknown))
  $ command -V git
  git is hashed (/bin/git)
  Adam@C-ADAM ~ ((unknown))
  $ git --version
  flashplayerplugingit version 1.8.1.msysgit.1
  Adam@C-ADAM ~ ((unknown))
  </code></pre>