Volume XXII, number 280Wednesday, October 7, 2026Latest message 1 hour ago

The Git List

News and archive of git@vger.kernel.org, since April 2005

Git maintenance fails without meaningful error message if any remote is no longer available

4 messages between Apr 29, 2026 and May 6, 2026, from Anselm Schüler, Phillip Wood.

Plain Markdown or JSON for tools and agents.

Anselm SchülerApr 29, 2026, 23:13 UTC on lore

I have a repo with multiple remotes, one of which no longer exists. When git-maintenance runs on it, it fails during the prefetch stage because that remote doesn’t exist anymore, and gives a mostly unhelpful error message:

$ git maintenance run --schedule=daily
ERROR: Repository not found.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists. error: failed to prefetch remotes error: task 'prefetch' failed

I think that
1. git-maintenance should report which remote it’s encountering an error on
2. git-maintenance should continue fetching other remotes even if one fails

Now, on my system, the systemd timers for git-maintenance use git-for-each-repo. Not sure if that’s upstream behaviour or something Nix/home-manager does. But if it is upstream behaviour, it would also be great to report the repo the error comes from, since I basically had to guess right now which repo was erroring. Luckily I have only three repos under maintenance so that was fine.

Let me know if you agree that this should be done. I would be open to writing a patch (no promises though)

Anselm
Phillip WoodMay 5, 2026, 09:59 UTC in reply to Anselm Schüler on lore

Re: Git maintenance fails without meaningful error message if any remote is no longer available

Hi Anselm
On 30/04/2026 00:13, Anselm Schüler wrote:
Show 17 quoted lines
> I have a repo with multiple remotes, one of which no longer exists. When 
> git-maintenance runs on it, it fails during the prefetch stage because 
> that remote doesn’t exist anymore, and gives a mostly unhelpful error 
> message:
> 
> $ git maintenance run --schedule=daily
> ERROR: Repository not found.
> fatal: Could not read from remote repository.
> 
> Please make sure you have the correct access rights
> and the repository exists.
> error: failed to prefetch remotes
> error: task 'prefetch' failed
> 
> I think that
> 1. git-maintenance should report which remote it’s encountering an error on
> 2. git-maintenance should continue fetching other remotes even if one fails

Since c75662bfc9 (maintenance: running maintenance should not stop on errors, 2024-04-24) which is in git 2.45.3 the systemd timer files installed by "git maintenance start" use "git for-each-repo --keep-going --config=..." to avoid this problem. Unfortunately we don't have a way to automatically upgrade the timer files for users who ran "git maintenance start" before that. I think if you run

	git maintenance stop
	git maintenance start

It will delete the old timer files and install the new ones. If that does not work you'll need to manually edit the files and add "--keep-going" to "git for-each-repo".

Thanks
Phillip
Show 13 quoted lines
> Now, on my system, the systemd timers for git-maintenance use git-for- 
> each-repo. Not sure if that’s upstream behaviour or something Nix/home- 
> manager does. But if it is upstream behaviour, it would also be great to 
> report the repo the error comes from, since I basically had to guess 
> right now which repo was erroring. Luckily I have only three repos under 
> maintenance so that was fine.
> 
> Let me know if you agree that this should be done. I would be open to 
> writing a patch (no promises though)
> 
> Anselm
> 
> 
Anselm SchülerMay 5, 2026, 10:05 UTC in reply to Phillip Wood on lore

Re: Git maintenance fails without meaningful error message if any remote is no longer available

[ This is a duplicate message because I forgot to hit Reply All the last time ]

Hi Phillip,

I think there may be a misunderstanding. My current systemd timers do use --keep-going. The issue is that on the individual repo, git-maintenance won’t fetch other remotes if one remote fails. --keep-going will ensure that the other repos get processed, but the repo with the failing remote won’t fetch any remotes after the failing one.

At least, that’s what appears to be happening from the output of the command.

On 05/05/2026 11:59, Phillip Wood wrote:
Show 55 quoted lines
> Hi Anselm
>
> On 30/04/2026 00:13, Anselm Schüler wrote:
>> I have a repo with multiple remotes, one of which no longer exists. 
>> When git-maintenance runs on it, it fails during the prefetch stage 
>> because that remote doesn’t exist anymore, and gives a mostly 
>> unhelpful error message:
>>
>> $ git maintenance run --schedule=daily
>> ERROR: Repository not found.
>> fatal: Could not read from remote repository.
>>
>> Please make sure you have the correct access rights
>> and the repository exists.
>> error: failed to prefetch remotes
>> error: task 'prefetch' failed
>>
>> I think that
>> 1. git-maintenance should report which remote it’s encountering an 
>> error on
>> 2. git-maintenance should continue fetching other remotes even if one 
>> fails
>
> Since c75662bfc9 (maintenance: running maintenance should not stop on 
> errors, 2024-04-24) which is in git 2.45.3 the systemd timer files 
> installed by "git maintenance start" use "git for-each-repo 
> --keep-going --config=..." to avoid this problem. Unfortunately we 
> don't have a way to automatically upgrade the timer files for users 
> who ran "git maintenance start" before that. I think if you run
>
>     git maintenance stop
>     git maintenance start
>
> It will delete the old timer files and install the new ones. If that 
> does not work you'll need to manually edit the files and add 
> "--keep-going" to "git for-each-repo".
>
> Thanks
>
> Phillip
>
>> Now, on my system, the systemd timers for git-maintenance use 
>> git-for- each-repo. Not sure if that’s upstream behaviour or 
>> something Nix/home- manager does. But if it is upstream behaviour, it 
>> would also be great to report the repo the error comes from, since I 
>> basically had to guess right now which repo was erroring. Luckily I 
>> have only three repos under maintenance so that was fine.
>>
>> Let me know if you agree that this should be done. I would be open to 
>> writing a patch (no promises though)
>>
>> Anselm
>>
>>
>
Phillip WoodMay 6, 2026, 14:06 UTC in reply to Anselm Schüler on lore

Re: Git maintenance fails without meaningful error message if any remote is no longer available

Hi Anselm
On 05/05/2026 11:05, Anselm Schüler wrote:
Show 13 quoted lines
> [ This is a duplicate message because I forgot to hit Reply All the last 
> time ]
> 
> Hi Phillip,
> 
> I think there may be a misunderstanding. My current systemd timers do 
> use --keep-going. The issue is that on the individual repo, git- 
> maintenance won’t fetch other remotes if one remote fails. --keep-going 
> will ensure that the other repos get processed, but the repo with the 
> failing remote won’t fetch any remotes after the failing one.
> 
> At least, that’s what appears to be happening from the output of the 
> command.

Oh sorry I'd misunderstood what was happening. I think that error comes from "git fetch --all" which dying in connect.c:die_initial_contact(). If there is one remote that is causing problems you could set remote.<name>.skipFetchAll so that git maintenance does not try and fetch from it. I've Cc'd Stolee to see if he has any better ideas for fixing this.

Thanks
Phillip
Show 57 quoted lines
> On 05/05/2026 11:59, Phillip Wood wrote:
>> Hi Anselm
>>
>> On 30/04/2026 00:13, Anselm Schüler wrote:
>>> I have a repo with multiple remotes, one of which no longer exists. 
>>> When git-maintenance runs on it, it fails during the prefetch stage 
>>> because that remote doesn’t exist anymore, and gives a mostly 
>>> unhelpful error message:
>>>
>>> $ git maintenance run --schedule=daily
>>> ERROR: Repository not found.
>>> fatal: Could not read from remote repository.
>>>
>>> Please make sure you have the correct access rights
>>> and the repository exists.
>>> error: failed to prefetch remotes
>>> error: task 'prefetch' failed
>>>
>>> I think that
>>> 1. git-maintenance should report which remote it’s encountering an 
>>> error on
>>> 2. git-maintenance should continue fetching other remotes even if one 
>>> fails
>>
>> Since c75662bfc9 (maintenance: running maintenance should not stop on 
>> errors, 2024-04-24) which is in git 2.45.3 the systemd timer files 
>> installed by "git maintenance start" use "git for-each-repo --keep- 
>> going --config=..." to avoid this problem. Unfortunately we don't have 
>> a way to automatically upgrade the timer files for users who ran "git 
>> maintenance start" before that. I think if you run
>>
>>     git maintenance stop
>>     git maintenance start
>>
>> It will delete the old timer files and install the new ones. If that 
>> does not work you'll need to manually edit the files and add "--keep- 
>> going" to "git for-each-repo".
>>
>> Thanks
>>
>> Phillip
>>
>>> Now, on my system, the systemd timers for git-maintenance use git- 
>>> for- each-repo. Not sure if that’s upstream behaviour or something 
>>> Nix/home- manager does. But if it is upstream behaviour, it would 
>>> also be great to report the repo the error comes from, since I 
>>> basically had to guess right now which repo was erroring. Luckily I 
>>> have only three repos under maintenance so that was fine.
>>>
>>> Let me know if you agree that this should be done. I would be open to 
>>> writing a patch (no promises though)
>>>
>>> Anselm
>>>
>>>
>>
> 

Back to recent threads