This can also be triggered by a bad network connection. I sometimes have to switch to using my phone as a hotspot to stop Git giving the following error:
fatal: TaskCanceledException encountered.
A task was canceled.
Perhaps it's an authentication timeout that triggers it?