Skip to content

Git Bash: Space in paths not handled properly #748

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 task done
lifenstein opened this issue May 6, 2016 · 7 comments
Closed
1 task done

Git Bash: Space in paths not handled properly #748

lifenstein opened this issue May 6, 2016 · 7 comments

Comments

@lifenstein
Copy link

lifenstein commented May 6, 2016

  • I was not able to find an open
    or closed issue
    matching what I'm seeing

Setup

  • Which version of Git for Windows are you using? 32-bit or 64-bit? Include the
    output of git version as well.

    Git 2.8.2 64 bit

$ git --version
git version 2.8.2.windows.1
  • Which version of Windows are you running? 32-bit or 64-bit?

    Windows 7 Enterprise, 64-bit, SP1

  • What options did you set as part of the installation? Or did you choose the
    defaults?

    Components: No "Additional icons"; checked everything else.
    PATH: 'Use Git and optional Unix tools from the Windows Command Prompt'
    SSH Executable: OpenSSH
    Line Ending conversions: Checkout Windows-style, commit Unix-style line endings
    Emulator: MinTTY
    Extra Options: Both "Enable file system caching" and "Enable Git Credential Manager" checked.

  • Any other interesting things about your environment that might be related
    to the issue you're seeing?

    • I have SourceTree installed, which has an embedded version of Git for Windows, which also shows this error.
    • My user's PATH is as follows:
%CommonProgramFiles%\Microsoft Shared\Windows Live;C:\Users\user\AppData\Roaming\npm;c:\Users\user\AppData\Local\atom\bin;C:\PROGRA~2\Oracle\VirtualBox;C:\Users\user\AppData\Local\Code\bin;C:\Users\user\AppData\Local\atom\bin
  • My system PATH is as follows:
C:\Windows;C:\Windows\system32;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\HashiCorp\Vagrant\bin;C:\PROGRA~2\Oracle\VirtualBox;C:\PROGRA~2\Oracle\VirtualBox;C:\Program Files (x86)\MiKTeX 2.9\miktex\bin\;C:\Program Files (x86)\nodejs\;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Program Files (x86)\WinSCP\;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files\Ruby22-x64\bin;C:\Program Files\SourceGear\Common\DiffMerge\;C:\ProgramData\chocolatey\bin;C:\ProgramData\ComposerSetup\bin;C:\ProgramData\Oracle\Java\javapath;C:\Software\RubyDevKit\bin;C:\Software\UnxUtils\usr\local\wbin;C:\Users\user\AppData\Local\Atlassian\SourceTree\git_local\bin;c:\Users\user\AppData\Local\atom\bin;C:\Users\user\AppData\Local\Code\bin;C:\Users\user\AppData\Roaming\Composer\vendor\bin;C:\Users\user\AppData\Roaming\npm;C:\Users\user\xampp\php;C:\Users\user\xampp\php\ext;C:\Program Files (x86)\FrontRange Solutions\Service Management\;C:\Program Files\TortoiseSVN\bin;C:\Program Files\Git\cmd;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Users\user\AppData\Roaming\npm;c:\Users\user\AppData\Local\atom\bin;C:\PROGRA~2\Oracle\VirtualBox;C:\Users\user\AppData\Local\Code\bin;C:\Users\user\AppData\Local\atom\bin

Details

  • Which terminal/shell are you running Git from? e.g Bash/CMD/PowerShell/other

    Git Bash

  • What commands did you run to trigger this issue? If you can provide a
    Minimal, Complete, and Verifiable example
    this will help us understand the issue.

    • Opening the shell.
  • What did you expect to occur after running these commands?

    • The bash prompt
  • What actually happened instead?

    • A giant wall of text with, what seems to be, the same error: 'not a valid identifier'. The full output is in git bash prompt ouput.txt.
  • If the problem was occurring with a specific repository, can you provide the
    URL to that repository to help us with testing?

    (No.)

@lifenstein
Copy link
Author

I can reproduce the error by running bash. The output is cleaner this time as I had the chance to maximise the window before running it.

git bash prompt ouput.txt

@landstander668
Copy link

landstander668 commented May 6, 2016

I'm not able to reproduce this on Windows 7 Professional SP1 64-bit, and my PATH setting incudes lots of spaces, so there's definitely something weird going on here. On the assumption that it isn's simply a damaged Git for Windows installation, could you please try running the following from the Windows command prompt?

cd /d "C:\Program Files\Git"
set PATH=C:\Windows;C:\Windows\system32;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\HashiCorp\Vagrant\bin;C:\PROGRA~2\Oracle\VirtualBox;C:\PROGRA~2\Oracle\VirtualBox;C:\Program Files (x86)\MiKTeX 2.9\miktex\bin\;C:\Program Files (x86)\nodejs\;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Program Files (x86)\WinSCP\;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files\Ruby22-x64\bin;C:\Program Files\SourceGear\Common\DiffMerge\;C:\ProgramData\chocolatey\bin;C:\ProgramData\ComposerSetup\bin;C:\ProgramData\Oracle\Java\javapath;C:\Software\RubyDevKit\bin;C:\Software\UnxUtils\usr\local\wbin;c:\Users\user\AppData\Local\atom\bin;C:\Users\user\AppData\Local\Code\bin;C:\Users\user\AppData\Roaming\Composer\vendor\bin;C:\Users\user\AppData\Roaming\npm;C:\Users\user\xampp\php;C:\Users\user\xampp\php\ext;C:\Program Files (x86)\FrontRange Solutions\Service Management\;C:\Program Files\TortoiseSVN\bin;C:\Program Files\Git\cmd;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Users\user\AppData\Roaming\npm;c:\Users\user\AppData\Local\atom\bin;C:\PROGRA~2\Oracle\VirtualBox;C:\Users\user\AppData\Local\Code\bin;C:\Users\user\AppData\Local\atom\bin;%CommonProgramFiles%\Microsoft Shared\Windows Live;C:\Users\user\AppData\Roaming\npm;c:\Users\user\AppData\Local\atom\bin;C:\PROGRA~2\Oracle\VirtualBox;C:\Users\user\AppData\Local\Code\bin;C:\Users\user\AppData\Local\atom\bin
git-bash

All this done is temporarily remove C:\Users\user\AppData\Local\Atlassian\SourceTree\git_local\bin from your PATH setting, so we can see if the issue is caused by a conflict with the Git version bundled with SourceTree.

@dscho
Copy link
Member

dscho commented May 7, 2016

@lifenstein there is a clear indication of drush being installed. So you did not tell us the complete truth: you probably have installed Drupal in some form at some point, and it is quite possible that your $HOME/.bashrc (or a similar file) contain commands that the Git Bash does not like.

@lifenstein
Copy link
Author

lifenstein commented May 7, 2016

@landstander668 I am having the issue at my work computer, will do as you say when I get back to work.

@dscho Didn't realise Drush could be a factor! The issue seemed to be from the export commands somewhere in the init not handling spaces in paths correctly, and thought the PATH being too long may have had something to do with it.

@dscho
Copy link
Member

dscho commented May 8, 2016

Didn't realise Drush could be a factor!

Well, it was in the log.

The issue seemed to be from the export commands somewhere in the init not handling spaces in paths correctly

Probably missing quoting.

@lifenstein
Copy link
Author

The issue was fixed by removing reference to drush in bashrc. Thanks @dscho !

@dscho dscho closed this as completed Jul 20, 2016
@dscho
Copy link
Member

dscho commented Jul 20, 2016

Thanks for reporting back!

dscho added a commit that referenced this issue May 22, 2025
This feature was introduced in #736 but had a few pain points that were
discovered when testing the full replacement of the existing
post-index-change and post-command hooks in our internal environment:

1. When using `core.hooksPath` to point to a directory within the
worktree, the sentinel files were being written into the worktree. Write
to `$GITDIR/info/` instead.
2. The existing internal post-index-change hook only signaled that work
needed to be done if actually the _worktree_ changed. Make the sentinel
file logic more restrictive to only write in these cases.

Tests are added to confirm both of these behavior changes.

To reflect the changed behavior, the name `post-index-change` was renamed
to `worktree-change`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants