'How to write bash script to loop through a git fetch command

I've been trying to fetch all branches of a git repository

using "git fetch"

but due to network issue it's failing

Then after searching for a while I tried

"git fetch --depth=n" , n = 1, 10, 20, .....

but this failed too even with value 1. next attempt was

"git fetch origin 'branchname' --depth=n"

but I don't want to manually put this command every time.Would be a lot easier if I could find a bash-script to increase n by 100 and run this command in a loop. Any help would be much appreciated. Thanks in advance



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source