Jenkins on Windows: Git command fails to fetch remote branch in batch job, but works manually (same admin account)

Jenkins setup:Jenkins 2.504
Java:21.0.6
Git:2.31
The controller node and agent node services are running on a single Windows 10 PC,and with all services running under the same admin account.
Confirmed that both the branch name and repository URL are correct, but executing Git commands in a Windows batch command returns a ‘remote branch not found’ error, while running the same Git commands directly in Git Shell successfully pulls the code

might depend on the way you installed git on windows. Seems you need to authenticate your requests gut git is not able to make use of the credentials helper.
why are you not using the corresponding built-in steps from Jenkins to checkout your sources? There you can set the credentials to be used.