{"thread":{"id":"40490","subject":"git config credential.helper with absolute path on windows not working properly","startedAt":"2015-10-05T20:40:21Z","lastAt":"2017-09-26T14:58:47Z","messageCount":2,"participants":["Valentin Stanciu","bcampolo"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"271173","messageId":"CADmzSDHbH-=bX=PFqvoe23iQPF7Mq6ogV7D9c0XjdXUsORgmBQ@mail.gmail.com","threadId":"40490","inReplyTo":null,"subject":"git config credential.helper with absolute path on windows not working properly","fromName":"Valentin Stanciu","fromEmail":"svalentin@google.com","sentAt":"2015-10-05T20:40:21Z","receivedAt":"2015-10-05T20:40:21Z","isPatch":false,"sender":{"key":"svalentin@google.com","avatar":null},"body":"Hey guys,\n\nI recently found that specifying absolute paths for credential helper\non windows does not work correctly if the path has spaces or non\nalphanumeric characters like parentheses. From what I gather it seems\nto do with how args are passed to subprocesses.\n\nexample:\ngit config credential.helper \"C:\\tmp\\a (b)\\git-credential-helper.cmd\"\n\nRunning `git config credential.helper` shows that git got the full path:\nC:\\tmp\\a (b)\\git-credential-helper.cmd\n\nHowever, when running `git push`, for example, git has problems\ninvoking the credential helper. If the path has no spaces or\nparentheses, then everything is fine.\n\nI tried countless ways of escaping the path, but couldn't find a\nproper way to pass this to git and make it work. Tried adding more\nquotes, slashes, and '^' (escape character for batch). Escaping spaces\nwith slashes seems to work, but couldn't find a way to escape\ncharacters like '(' and '('.\nI think git needs to add some escaping or quotes when running the\ncredential helper.\n\nThis affects commands that inline the credential helper too:\ngit clone https://path.to.repo.com C:\\tmp\\default --config\ncredential.helper=\"c:\\tmp\\a (b)\\git-credential-gcloud.cmd\"\n\nNot sure if this is limited to credential helper or any config in git,\nbut this is a case I could repro easily.\n\nTested on Windows 7 x64 with all updates installed, from the command\nline, using git version 2.6.0.windows.1. Git is installed to be\navailable from the command line.\n\n\nThanks,\nValentin\n"},{"id":"328948","messageId":"1506437512234-0.post@n2.nabble.com","threadId":"40490","inReplyTo":"CADmzSDHbH-=bX=PFqvoe23iQPF7Mq6ogV7D9c0XjdXUsORgmBQ@mail.gmail.com","subject":"Re: git config credential.helper with absolute path on windows not working properly","fromName":"bcampolo","fromEmail":"bcampolo@mmm.com","sentAt":"2017-09-26T14:51:52Z","receivedAt":"2017-09-26T14:58:47Z","isPatch":false,"sender":{"key":"bcampolo@mmm.com","avatar":null},"body":"My situation was a little different, but I was able to get this to work with\nsome interesting escaping.\n\nhelper = !\"\\\"C:\\\\Path with spaces\\\\executable\\\"\" --option1 value1\ncredential-helper $@\n\nNotice the exclamation, quoted path of executable and extra escaped quotes\ninside of that, plus escaped backslashes.\n\n\n\n\n\n\n--\nSent from: http://git.661346.n2.nabble.com/\n"}]}