#StackBounty: #git #powershell-v4.0 Running "Git-Clone" from Powershell giving errors even when it seems to work

Bounty: 50

How do I interpret the errors coming out of this PowerShell script that calls “Git Clone” (actually using GitLab). And can I clone an empty directory and cause it to work without getting errors?

$path1 = "d:GitPath" 
$path2 = "${path1}mycompany-mygroup-nealtestautomation01-map"
$gitLabHttp = "http://git.mycompany.com/MyGroup/nealtestscriptaddedproject.git"
$gitLabHttp = "http://git.mycompany.com/MyGroup/mycompany-gwcustomers-nealtestautomation01-map.git" 
rd $path2 
cd $path1
git clone $gitLabHttp --local --verbose

Output:

git : Cloning into 'mycompany-mygroup-nealtestautomation01210-map'...
At D:ScriptsGitCloneTest.ps1:7 char:1
+ git clone $gitLabHttp --local --verbose
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (Cloning into '...mation01-map'...:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

warning: --local is ignored
warning: You appear to have cloned an empty repository.

Any the larger script where I want to use this code, I include this:

$ErrorActionPreference = "Stop"  #Special Poweshell Syntax to Stop on First Error 

so that it stops on the first error.

Even when I run it on a non-empty project, I see red and errors similar to above (took the –local and –verbose off this run):

git : Cloning into 'xxx.yyy.CanInvToOutZZZ210.Map'...
At D:ScriptsGitCloneTest2.ps1:5 char:1
+ git clone $gitLabHttp
+ ~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (Cloning into 'E...Intl210.Map'...:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

If I run from windows command prompt, it runs nicely with some stats:

D:GitGWCustomerMapsTest2>git clone myrealurlhidden 
Cloning into 'XXX.YYY.CanInvToOutZZZZ210.Map'...
remote: Counting objects: 29, done.
remote: Compressing objects: 100% (28/28), done.
remote: Total 29 (delta 9), reused 0 (delta 0)
Unpacking objects: 100% (29/29), done.


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.