{"thread":{"id":"65567","subject":"Git maintenance fails without meaningful error message if any remote is no longer available","startedAt":"2026-04-29T23:13:30Z","lastAt":"2026-05-06T14:06:39Z","messageCount":4,"participants":["Anselm Schüler","Phillip Wood"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"542490","messageId":"0f3ef394-d96a-42f2-825d-53cb475a2363@anselmschueler.com","threadId":"65567","inReplyTo":null,"subject":"Git maintenance fails without meaningful error message if any remote is no longer available","fromName":"Anselm Schüler","fromEmail":"mail@anselmschueler.com","sentAt":"2026-04-29T23:13:22Z","receivedAt":"2026-04-29T23:13:30Z","isPatch":false,"body":"I have a repo with multiple remotes, one of which no longer exists. When \ngit-maintenance runs on it, it fails during the prefetch stage because \nthat remote doesn’t exist anymore, and gives a mostly unhelpful error \nmessage:\n\n$ git maintenance run --schedule=daily\nERROR: Repository not found.\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights\nand the repository exists.\nerror: failed to prefetch remotes\nerror: task 'prefetch' failed\n\nI think that\n1. git-maintenance should report which remote it’s encountering an error on\n2. git-maintenance should continue fetching other remotes even if one fails\n\nNow, on my system, the systemd timers for git-maintenance use \ngit-for-each-repo. Not sure if that’s upstream behaviour or something \nNix/home-manager does. But if it is upstream behaviour, it would also be \ngreat to report the repo the error comes from, since I basically had to \nguess right now which repo was erroring. Luckily I have only three repos \nunder maintenance so that was fine.\n\nLet me know if you agree that this should be done. I would be open to \nwriting a patch (no promises though)\n\nAnselm\n\n"},{"id":"542756","messageId":"5e3bcfdb-d3aa-4494-81d6-15b0dfd43af1@gmail.com","threadId":"65567","inReplyTo":"0f3ef394-d96a-42f2-825d-53cb475a2363@anselmschueler.com","subject":"Re: Git maintenance fails without meaningful error message if any remote is no longer available","fromName":"Phillip Wood","fromEmail":"phillip.wood123@gmail.com","sentAt":"2026-05-05T09:59:32Z","receivedAt":"2026-05-05T09:59:35Z","isPatch":false,"body":"Hi Anselm\n\nOn 30/04/2026 00:13, Anselm Schüler wrote:\n> I have a repo with multiple remotes, one of which no longer exists. When \n> git-maintenance runs on it, it fails during the prefetch stage because \n> that remote doesn’t exist anymore, and gives a mostly unhelpful error \n> message:\n> \n> $ git maintenance run --schedule=daily\n> ERROR: Repository not found.\n> fatal: Could not read from remote repository.\n> \n> Please make sure you have the correct access rights\n> and the repository exists.\n> error: failed to prefetch remotes\n> error: task 'prefetch' failed\n> \n> I think that\n> 1. git-maintenance should report which remote it’s encountering an error on\n> 2. git-maintenance should continue fetching other remotes even if one fails\n\nSince c75662bfc9 (maintenance: running maintenance should not stop on \nerrors, 2024-04-24) which is in git 2.45.3 the systemd timer files \ninstalled by \"git maintenance start\" use \"git for-each-repo --keep-going \n--config=...\" to avoid this problem. Unfortunately we don't have a way \nto automatically upgrade the timer files for users who ran \"git \nmaintenance start\" before that. I think if you run\n\n\tgit maintenance stop\n\tgit maintenance start\n\nIt will delete the old timer files and install the new ones. If that \ndoes not work you'll need to manually edit the files and add \n\"--keep-going\" to \"git for-each-repo\".\n\nThanks\n\nPhillip\n\n> Now, on my system, the systemd timers for git-maintenance use git-for- \n> each-repo. Not sure if that’s upstream behaviour or something Nix/home- \n> manager does. But if it is upstream behaviour, it would also be great to \n> report the repo the error comes from, since I basically had to guess \n> right now which repo was erroring. Luckily I have only three repos under \n> maintenance so that was fine.\n> \n> Let me know if you agree that this should be done. I would be open to \n> writing a patch (no promises though)\n> \n> Anselm\n> \n> \n\n"},{"id":"542757","messageId":"0076773f-85c5-475b-96c7-bd85c9e5699a@anselmschueler.com","threadId":"65567","inReplyTo":"5e3bcfdb-d3aa-4494-81d6-15b0dfd43af1@gmail.com","subject":"Re: Git maintenance fails without meaningful error message if any remote is no longer available","fromName":"Anselm Schüler","fromEmail":"mail@anselmschueler.com","sentAt":"2026-05-05T10:05:35Z","receivedAt":"2026-05-05T10:10:57Z","isPatch":false,"body":"[ This is a duplicate message because I forgot to hit Reply All the last \ntime ]\n\nHi Phillip,\n\nI think there may be a misunderstanding. My current systemd timers do \nuse --keep-going. The issue is that on the individual repo, \ngit-maintenance won’t fetch other remotes if one remote fails. \n--keep-going will ensure that the other repos get processed, but the \nrepo with the failing remote won’t fetch any remotes after the failing one.\n\nAt least, that’s what appears to be happening from the output of the \ncommand.\n\nOn 05/05/2026 11:59, Phillip Wood wrote:\n> Hi Anselm\n>\n> On 30/04/2026 00:13, Anselm Schüler wrote:\n>> I have a repo with multiple remotes, one of which no longer exists. \n>> When git-maintenance runs on it, it fails during the prefetch stage \n>> because that remote doesn’t exist anymore, and gives a mostly \n>> unhelpful error message:\n>>\n>> $ git maintenance run --schedule=daily\n>> ERROR: Repository not found.\n>> fatal: Could not read from remote repository.\n>>\n>> Please make sure you have the correct access rights\n>> and the repository exists.\n>> error: failed to prefetch remotes\n>> error: task 'prefetch' failed\n>>\n>> I think that\n>> 1. git-maintenance should report which remote it’s encountering an \n>> error on\n>> 2. git-maintenance should continue fetching other remotes even if one \n>> fails\n>\n> Since c75662bfc9 (maintenance: running maintenance should not stop on \n> errors, 2024-04-24) which is in git 2.45.3 the systemd timer files \n> installed by \"git maintenance start\" use \"git for-each-repo \n> --keep-going --config=...\" to avoid this problem. Unfortunately we \n> don't have a way to automatically upgrade the timer files for users \n> who ran \"git maintenance start\" before that. I think if you run\n>\n>     git maintenance stop\n>     git maintenance start\n>\n> It will delete the old timer files and install the new ones. If that \n> does not work you'll need to manually edit the files and add \n> \"--keep-going\" to \"git for-each-repo\".\n>\n> Thanks\n>\n> Phillip\n>\n>> Now, on my system, the systemd timers for git-maintenance use \n>> git-for- each-repo. Not sure if that’s upstream behaviour or \n>> something Nix/home- manager does. But if it is upstream behaviour, it \n>> would also be great to report the repo the error comes from, since I \n>> basically had to guess right now which repo was erroring. Luckily I \n>> have only three repos under maintenance so that was fine.\n>>\n>> Let me know if you agree that this should be done. I would be open to \n>> writing a patch (no promises though)\n>>\n>> Anselm\n>>\n>>\n>\n"},{"id":"542812","messageId":"40361c53-36f6-4769-a721-88de5fcf3910@gmail.com","threadId":"65567","inReplyTo":"0076773f-85c5-475b-96c7-bd85c9e5699a@anselmschueler.com","subject":"Re: Git maintenance fails without meaningful error message if any remote is no longer available","fromName":"Phillip Wood","fromEmail":"phillip.wood123@gmail.com","sentAt":"2026-05-06T14:06:30Z","receivedAt":"2026-05-06T14:06:39Z","isPatch":false,"body":"Hi Anselm\n\nOn 05/05/2026 11:05, Anselm Schüler wrote:\n> [ This is a duplicate message because I forgot to hit Reply All the last \n> time ]\n> \n> Hi Phillip,\n> \n> I think there may be a misunderstanding. My current systemd timers do \n> use --keep-going. The issue is that on the individual repo, git- \n> maintenance won’t fetch other remotes if one remote fails. --keep-going \n> will ensure that the other repos get processed, but the repo with the \n> failing remote won’t fetch any remotes after the failing one.\n> \n> At least, that’s what appears to be happening from the output of the \n> command.\n\nOh sorry I'd misunderstood what was happening. I think that error comes \nfrom \"git fetch --all\" which dying in connect.c:die_initial_contact(). \nIf there is one remote that is causing problems you could set \nremote.<name>.skipFetchAll so that git maintenance does not try and \nfetch from it. I've Cc'd Stolee to see if he has any better ideas for \nfixing this.\n\nThanks\n\nPhillip\n\n> On 05/05/2026 11:59, Phillip Wood wrote:\n>> Hi Anselm\n>>\n>> On 30/04/2026 00:13, Anselm Schüler wrote:\n>>> I have a repo with multiple remotes, one of which no longer exists. \n>>> When git-maintenance runs on it, it fails during the prefetch stage \n>>> because that remote doesn’t exist anymore, and gives a mostly \n>>> unhelpful error message:\n>>>\n>>> $ git maintenance run --schedule=daily\n>>> ERROR: Repository not found.\n>>> fatal: Could not read from remote repository.\n>>>\n>>> Please make sure you have the correct access rights\n>>> and the repository exists.\n>>> error: failed to prefetch remotes\n>>> error: task 'prefetch' failed\n>>>\n>>> I think that\n>>> 1. git-maintenance should report which remote it’s encountering an \n>>> error on\n>>> 2. git-maintenance should continue fetching other remotes even if one \n>>> fails\n>>\n>> Since c75662bfc9 (maintenance: running maintenance should not stop on \n>> errors, 2024-04-24) which is in git 2.45.3 the systemd timer files \n>> installed by \"git maintenance start\" use \"git for-each-repo --keep- \n>> going --config=...\" to avoid this problem. Unfortunately we don't have \n>> a way to automatically upgrade the timer files for users who ran \"git \n>> maintenance start\" before that. I think if you run\n>>\n>>     git maintenance stop\n>>     git maintenance start\n>>\n>> It will delete the old timer files and install the new ones. If that \n>> does not work you'll need to manually edit the files and add \"--keep- \n>> going\" to \"git for-each-repo\".\n>>\n>> Thanks\n>>\n>> Phillip\n>>\n>>> Now, on my system, the systemd timers for git-maintenance use git- \n>>> for- each-repo. Not sure if that’s upstream behaviour or something \n>>> Nix/home- manager does. But if it is upstream behaviour, it would \n>>> also be great to report the repo the error comes from, since I \n>>> basically had to guess right now which repo was erroring. Luckily I \n>>> have only three repos under maintenance so that was fine.\n>>>\n>>> Let me know if you agree that this should be done. I would be open to \n>>> writing a patch (no promises though)\n>>>\n>>> Anselm\n>>>\n>>>\n>>\n> \n\n"}]}