How to prevent 'git fetch' from hanging when executed from .bat file on Windows 10?

1,129 views
Skip to first unread message

Sergey Beloglazov

unread,
Nov 23, 2021, 10:31:15 AM11/23/21
to git-for-windows
Good day!

OS: Windows 10

Git: version 2.28.0.windows.1

I use Git for Windows for working with remote git repository. When I execute a command git fetch --all from command line it works fine. It update local repository from remote repository in several seconds. It takes less than 5-6 seconds. I have made a .bat file for Windows with commands like this

C:
cd C:\ProjectDir
git fetch --all

When I run it e.g. by using double-click in Windows Explorer it hangs. I wait for 1-2 minutes, but nothing happens. I tried add -v parameter to git. It shows all updated branches and hangs after it. I made a Windows link with working folder c:\ProjectDir and chandged .bat to 1 line command:

git fetch --all

But it hangs too. How can I use Windows Git in a .bat file?

Johannes Schindelin

unread,
Nov 23, 2021, 11:19:18 AM11/23/21
to Sergey Beloglazov, git-for-windows
Hi Sergey,

On Tue, 23 Nov 2021, Sergey Beloglazov wrote:

> C:
> cd C:\ProjectDir
> git fetch --all
>
> When I run it e.g. by using double-click in Windows Explorer it hangs. I
> wait for 1-2 minutes, but nothing happens. I tried add -v parameter to git.
> It shows all updated branches and hangs after it. I made a Windows link
> with working folder c:\ProjectDir and chandged .bat to 1 line command:
>
> git fetch --all
>
> But it hangs too. How can I use Windows Git in a .bat file?

Curious.

Have you had a chance to see what it does by running Process Monitor
(https://docs.microsoft.com/en-us/sysinternals/downloads/procmon)?

Ciao,
Johannes
Reply all
Reply to author
Forward
0 new messages