{"thread":{"id":"53449","subject":"git-credential-store does not work with a file","startedAt":"2020-05-12T00:47:49Z","lastAt":"2020-05-13T21:53:50Z","messageCount":3,"participants":["David Moseler","Carlo Marcelo Arenas Belón","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"397588","messageId":"uBc-Htk5XJFPF28aiZsQUIowfd66Ay2NiCyVbxkWpD77ugn3k4LBLse-jm0Jf4HpAKMWt4chuRAbxskeczZpj_pEnUaX_XOrmhfYksCeVLw=@protonmail.com","threadId":"53449","inReplyTo":"56HlWgfQEg1t99VKZaFZqhdcjAs279HXXP1gQ9YzZGOGcR9jEzSVYgl3flvbTiqSet2HB0gc6jotcDmYbtDipE7k0-QbdrzjgxiKZBnIK_4=@protonmail.com","subject":"git-credential-store does not work with a file","fromName":"David Moseler","fromEmail":"davidmoseler@protonmail.com","sentAt":"2020-05-12T00:40:10Z","receivedAt":"2020-05-12T00:47:49Z","isPatch":false,"sender":{"key":"davidmoseler@protonmail.com","avatar":null},"body":"Hi,\n\nI'm using git version 2.17.1. Providing a file to git-credential-store, such as in\n\ngit config credential.helper store --file='./git-credentials'\n\nis not working. When using this command, git writes to ~/.git-credentials in the home folder anyway.\n"},{"id":"397594","messageId":"20200512112201.GA10049@Carlos-MBP","threadId":"53449","inReplyTo":"uBc-Htk5XJFPF28aiZsQUIowfd66Ay2NiCyVbxkWpD77ugn3k4LBLse-jm0Jf4HpAKMWt4chuRAbxskeczZpj_pEnUaX_XOrmhfYksCeVLw=@protonmail.com","subject":"Re: git-credential-store does not work with a file","fromName":"Carlo Marcelo Arenas Belón","fromEmail":"carenas@gmail.com","sentAt":"2020-05-12T11:22:01Z","receivedAt":"2020-05-12T11:22:05Z","isPatch":false,"sender":{"key":"carenas@gmail.com","avatar":"https://avatars.githubusercontent.com/u/76036?v=4"},"body":"On Tue, May 12, 2020 at 12:40:10AM +0000, David Moseler wrote:\n> Hi,\n> \n> I'm using git version 2.17.1. Providing a file to git-credential-store, such as in\n> \n> git config credential.helper store --file='./git-credentials'\n\nyour quoting is off, so you are passing to config only the value 'store' while\nthe rest is ignored.\n\nwhat you really meant to use is probably :\n\n  git config credential.helper \"store --file=$PWD/git-credentials\"\n\nnote that using a relative path might not be what you really want, as the\ncontext for when that is run will not be what you expected most likely (ex:\nthe root of your repository)\n\n> is not working. When using this command, git writes to ~/.git-credentials in the home folder anyway.\n\nnote that credential.helper is a multi value setting, so you probably also want\nto clear the list first, if your intention was to only use that file and not the\none in ~/.git-credentials.\n\nsee `git help gitcredentials` for details\n\nCarlo\n"},{"id":"397777","messageId":"xmqq1rnnsdqy.fsf@gitster.c.googlers.com","threadId":"53449","inReplyTo":"20200512112201.GA10049@Carlos-MBP","subject":"Re: git-credential-store does not work with a file","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-05-13T21:53:41Z","receivedAt":"2020-05-13T21:53:50Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Carlo Marcelo Arenas Belón <carenas@gmail.com> writes:\n\n> On Tue, May 12, 2020 at 12:40:10AM +0000, David Moseler wrote:\n>> Hi,\n>> \n>> I'm using git version 2.17.1. Providing a file to git-credential-store, such as in\n>> \n>> git config credential.helper store --file='./git-credentials'\n>\n> your quoting is off, so you are passing to config only the value 'store' while\n> the rest is ignored.\n\nActually it is worse than that.  If it were \"the rest is ignored\",\nwe can fix it to give an error.  But the problem is, the rest is\n*not* ignored.  It is used as an argument with a meaning that the\nuser did not expect it to have.\n\nThe above asks \"we want to update the value of credential.helper\nvariable(s) and set 'store' as its value, but we want to do so only\nfor the entries whose current value match the regular expression\ngiven as the last argument\".  \n\nIt is unlikely that a credential.helper variable defined with the\nvalue \"--file=./git-credentials\", so the command silently succeeds\nafter replacing 0 entries.  \n\nThe same issue exists with \"--replace-all\", \"--unset\" and other\nforms of \"git config\" that take an optional value_regex.\n\nThis is now totally offtopic for a thread about credential-store,\nbut we probably should fix the command line UI for this feature.\n\nPerhaps\n\n 1) Teach all the forms of \"git config\" that currently takes an\n    optional value_regex to accept \"--value-regexp=regex\" option.\n    It will be an error to give both --value-regexp parameter and\n    the optional \"value_regex\" argument.  Wait for several releases.\n\n 2) Update these forms to warn when the current \"optional\"\n    value_regex syntax is used, and tell users to explicitly use the\n    \"--value-regexp=regex\" option.  Wait for several releases.\n\n 3) Remove support for the \"optional\" value_regex syntax and error\n    out when it is used.\n\nover a few years.\n"}]}