I think this may be a user misunderstanding. Have you placed diagnostic print statements into your pipeline script to show the value of
on the agent where it is failing? I suspect that environment variable is not defined on that agent, and that is what is causing the failure.
In general, authentication "bug reports" are usually not bugs, but rather configuration mistakes. If that environment variable is available on the agent, then please provide more detail of the agent platform (windows as a user, windows as a service, CentOS linux, Debian linux, Ubuntu linux, aix, FreeBSD, etc.), git version on the agent platform, and if there are any "interesting" characters in either the username or the password.