“Could not get current working directory” error on git clone

I try to clone a Git repository hosted on a VSTS instance in a PowerShell script to a network share:

git clone https://user:password@mycompany.visualstudio.com/DefaultCollection/MyProject/_git/MyRepository \\MyServer\MyBackupDirectory\MyRepository --mirror

While this works fine run from my local machine it fails while run on another machine (VSTS build agent) with the following error:

fatal: Could not get current working directory: No such file or directory

The same error is thrown if I run the above command directly in PowerShell. I don’t see how this could be related to the working directory. I suspect that it has something to do with permissions on the target file share, but the user has full control on the target path and with the same user I can manually create / delete folders in the target path.

Opposite to Git – fatal: Could not get current working directory? I also don’t change working directory or delete directories.

Update:
If I don’t clone with --mirror an empty directory is created on the target file share and I get the following errors:

fatal: Could not get current working directory: No such file or directory
Deletion of directory ´\\MyServer\MyBackupDirectory\MyRepository´ failed. Should I try again? (y/n)

Git Baby is a git and github fan, let's start git clone.