Git fails if Windows username contains spaces

This is an evolution of the thread I posted here:

I'm having a strange issue with only one PC. When I try to do any operations with msysgit from IDEA or PyCharm, it says that the operation has failed. It only does this for users whose usenames have spaces in them.

For example, if I'm logged in as "SomeUser", it will work fine. If I log in as "Some User", it will fail. This happens if I try to "Test" a new git remote-repo URL, or if I try to pull/fetch/push in an existing project.

And it only does this on one PC. Another PC, next to it, works for spaced and non-spaced usernames.

The idea.log file will contain something like the following:

2013-05-22 07:19:41,755 [229811539]   INFO -    #git4idea.update.GitFetcher - fetching H:\IdeaProjects\Project

2013-05-22 07:19:41,756 [229811540]   INFO -   git4idea.commands.GitHandler - cd H:\IdeaProjects\Project

2013-05-22 07:19:41,756 [229811540]   INFO -   git4idea.commands.GitHandler - git fetch --progress --prune origin

2013-05-22 07:19:41,812 [229811596]   INFO -   git4idea.commands.GitHandler - 'C:\Users\Some' is not recognized as an internal or external command,

2013-05-22 07:19:41,812 [229811596]   INFO -   git4idea.commands.GitHandler - operable program or batch file.

2013-05-22 07:19:41,813 [229811597]   INFO -   git4idea.commands.GitHandler - fatal: Could not read from remote repository.

So, somehow, git isn't getting the user's home directory properly quoted from IDEA. Oddly, if I run any of the commands reported by GitHandler (like "git fetch origin") from Git Bash, those work fine. It's only when trying to run Git from IDEA or PyCharm.


Comment actions Permalink

Hi Joe,

Which version of Windows and which version of msysGit do you use?

Comment actions Permalink

First off, thanks for taking an interest in this problem. I'm really frustrated by this issue as I can't do any development with this laptop, since I can't push/pull/fetch (well, I can, from the command-prompt but... blech!). I'm very close to just re-installing Windows and re-installing all of my applications and moving all of my projects over.

This is with Windows 8. Git Bash reports that it's version

IDEA version is 12.1.3 Build 129.451

I'm starting to suspect that the problem might lie with the underlying SSH (I also have VanDyke's SecureCRT installed, so I don't know if Git or IDEA is trying to run that instead of Git's ssh.exe... dunno).

I tried a variety of different Git URL's, and got differing results:

FAILS: ssh://
WORKS: git://

The first uses SSH. The second uses Github's HTTP interface. The third uses Git's SSH interface. The fourth uses the "Git read-only" URL from Github.

If I go into Settings->Version Control->Git and change "SSH executable" to "Native", then trying to test these URL's just causes the "Testing respository" dialog to come up and just sit, endlessly. If I use "Built-in", then I get the "Repository test has failed" messages I mentioned.

It's frustrating that I can't turn on more-verbose logging on the part of IDEA, so that I can see what it's trying to pass to git.exe.

Also, is there a way to pass different environment variables to IDEA? I want to try changing various paths (like "HOMEPATH") to things without spaces (like changing "C:\Users\Joe Emenaker" to "C:\Users\joeeme~1") to see if that fixes anything.

Also, I'm not sure about this, but I think the issue might have happened when I migrated my IDEA, PyCharm, and Git settings over from another Windows 7 machine. In order to save configuration hassle, I just copied "C:\Users\Joe Emenaker\.IntelliJIDEA12" and "C:\Users\Joe Emenaker\.PyCharm20" and a few other folders over from my Windows 7 machine. The path to home folder was exactly the same, so I wouldn't think that this would cause a problem. Also, since then, I've tried deleting those folders and having IDEA and PyCharm re-create them (and I've even re-installed IDEA and PyCharm), but the problem persists. Again, I'm not sure exactly when the problem arose, so I don't know if it is result of copying the config folders, so I'm heasitant to mention it... but, just in case it's relate, there it is.
Comment actions Permalink

Yeah, it looks like the problem is specific to the SSH interface.
Is your private SSH key protected with a passphrase?


Please sign in to leave a comment.