{"thread":{"id":"58471","subject":"Preserving credentials on authentication failures","startedAt":"2022-09-20T08:00:58Z","lastAt":"2022-09-21T21:13:25Z","messageCount":2,"participants":["Jan Tosovsky","brian m. carlson"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"463284","messageId":"007401d8ccc6$ef8ebe50$ceac3af0$@email.cz","threadId":"58471","inReplyTo":null,"subject":"Preserving credentials on authentication failures","fromName":"Jan Tosovsky","fromEmail":"j.tosovsky@email.cz","sentAt":"2022-09-20T07:59:38Z","receivedAt":"2022-09-20T08:00:58Z","isPatch":false,"sender":{"key":"j.tosovsky@email.cz","avatar":null},"body":"On my local Windows machine I maintain a credential store in the form of a\ntext file. But from time to time one of the entries disappears. I run\nregularly some background jobs, cloning some stuff, and I suspect this\nhappens when the external authentication service is down temporarily. When\nit is later resumed, I can't clone the repo anymore because of that deleted\nentry.\n\nIs there any option to keep entries on authentication failures? Or is this\nsimply a bug? Or is there another reason why this happens?\n\nGit 2.35.1.windows.2\n\nThanks, Jan\n\n"},{"id":"463391","messageId":"Yyt+bAllVYJ9+SXa@tapette.crustytoothpaste.net","threadId":"58471","inReplyTo":"007401d8ccc6$ef8ebe50$ceac3af0$@email.cz","subject":"Re: Preserving credentials on authentication failures","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2022-09-21T21:13:16Z","receivedAt":"2022-09-21T21:13:25Z","isPatch":false,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On 2022-09-20 at 07:59:38, Jan Tosovsky wrote:\n> On my local Windows machine I maintain a credential store in the form of a\n> text file. But from time to time one of the entries disappears. I run\n> regularly some background jobs, cloning some stuff, and I suspect this\n> happens when the external authentication service is down temporarily. When\n> it is later resumed, I can't clone the repo anymore because of that deleted\n> entry.\n> \n> Is there any option to keep entries on authentication failures? Or is this\n> simply a bug? Or is there another reason why this happens?\n\nIf you have a credential helper and the credentials retrieved from it\ncause the server to send a 401, then Git will erase the credentials and\nask for new ones.  If your auth service is down, then the best thing for\nyour Git server to do is return a 503 if service cannot be maintained.\nIf it returns a 401 (which is not correct according to the RFC), then\nGit will clear the credentials.\n\nGit doesn't provide an option to preserve entries on authentication\nfailure, but you could write a simple shell script that wraps your\nnormal credential helper and ignores the \"erase\" command and use that\ninstead in `credential.helper`.\n-- \nbrian m. carlson (he/him or they/them)\nToronto, Ontario, CA\n"}]}