I was recently working with Amazon’s guide to setting up CodeCommit via HTTPS on Windows 10 (http://docs.aws.amazon.com/codecommit/latest/userguide/setting-up-https-windows.html), and I got up to the section titled “Step 3: Set Up the Credential Helper”. I ran the code they suggested:
cd %PROGRAMFILES(X86)%\AWS Tools\CodeCommit git-credential-AWSS4.exe
Unhandled Exception: System.ArgumentException: Illegal characters in path. at System.IO.Path.CheckInvalidPathChars(String path, Boolean checkAdditional) at System.IO.Path.Combine(String path1, String path2) at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext() at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext() at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source) at Git.Credential.AWSS4.Program.InstallTheApp(String pathToGit, Boolean silent, String installPath, String credentialProfile) at Git.Credential.AWSS4.Program.Main(String args)
Took me a little while to figure this one out.
When I first looked at the new Windows 10 PATH editor, I was pretty impressed – no longer did I have to deal with a single textbox for the entire PATH, within a window that didn’t allow me to resize it. Instead, I have a spiffy new editor where I can modify things line-by-line. And look at that, a “Browse” button! How useful!
Here’s tip #1 – don’t click that Browse button immediately. It will overwrite whatever you have selected – which will be the top option initially, which by default is %SystemRoot%\system32…don’t remove that from your PATH. Trust me. Instead, first hit the “New” button, then hit “Browse”. You can now browse around on your file system for folders and add them to your PATH. In my case, I had just installed Git, and I needed to add it. So, I browsed around for the Git install location and added it, and the location was added for me to the PATH:
Note those quotation marks. Seems like it should be fine, after all, “Program Files” has a space in it. Opening a new CMD window, I could run the git command just fine. I continued on with the Amazon instructions, until I ran the code that I pasted above, and got that error – “Illegal characters in path.” Strange, I don’t think there’s anything wrong with my PATH, everything else works just fine. I decided to double check, opening the PATH editor again:
Note that the quotation marks are now gone, having exited and re-entered the PATH editor. I didn’t know what I was supposed to be looking for, and I didn’t notice the additional quotation marks the first time, so I didn’t think anything of it – but it turns out that the UI adds quotation marks when you use the Browse button, and after exiting and re-entering, it hides those quotation marks. Note that it ONLY hides them, it does NOT delete them – they’re actually still there, you just can’t see them.
There are two methods to see what’s ACTUALLY in your PATH. The first is to use the “old” editor, which at least now can be resized, which is nice. Just click on the “Edit Text” button:
The other way to do it is to open your command prompt and run “ECHO %PATH%”:
Both will show you the quotation marks that the new Windows 10 PATH editor hides. Now that you know which PATH entries secretly have quotation marks, go back into the PATH editor and delete those entries and enter them manually (or use the Browse button, but delete the automatically added quotation marks before hitting OK).
Now the Amazon Credentials Helper should work! Remember that you’ll need to open a different command prompt every time you make a change to your PATH.