J. Doe
J. Doe

Reputation: 1549

Why does ls work in GitShell, but ls -a or ls -la not work?

I started using GitShell on my Windows 7 computer in order to try to get a script to work properly. When I type ls into the shell, it works fine and displays the file. When I type ls -a, or ls -la it gives me this error -

Get-ChildItem : A parameter cannot be found that matches parameter name 'a'.
At line:1 char:6
+ ls -a <<<<
+ CategoryInfo          : InvalidArgument: (:) [Get-ChildItem], ParameterB
indingException
+ FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Comm
ands.GetChildItemCommand

My co-worker is using the commands on her identical computer just fine. What could the problem be?

Upvotes: 1

Views: 2368

Answers (2)

Bill Wheaton
Bill Wheaton

Reputation: 35

If you can use the GitHub gui client for a moment, then start it. Then open the "Options..." (under the little gear icon). Then where it has "Default Shell" choose "Git Bash" instead of "PowerShell".

Once you do that, then you can open the Git Shell, and it will open the bash shell instead, and you will then be able to use ls -al and all the other commands that powershell doesn't do right.

Upvotes: 1

Kev
Kev

Reputation: 119856

This is because you're typing commands into PowerShell not GitShell.

PowerShell does have a ls command but it's an alias of Get-ChildItem which doesn't have the same switches as the ls command as found in unix shells.

Upvotes: 4

Related Questions