Installing git-secrets on Windows

Viewed 2081

I've been trying to get git-secrets installed for the last couple of hours, and can not seem to figure it out. Google searching gets me almost nothing, almost all of the results are for git-secret (singular secret, not plural).

I cloned the folder to my computer and opened WindowsPower Shell in Administrator mode to run the install.ps1 file.

This is the output that I got from PowerShell:

https://i.stack.imgur.com/zGFHx.png

Checking to see if installation directory already exists...
Creating installation directory.
Copying files.
Copy-Item : Cannot find path 'C:\windows\system32\git-secrets' because it does not exist.
At C:\Users\ricci\Downloads\git-secrets\install.ps1:15 char:1
+ Copy-Item ./git-secrets -Destination $InstallationDirectory -Force
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (C:\windows\system32\git-secrets:String) [Copy-Item], ItemNotF
   oundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.CopyItemCommand

Copy-Item : Cannot find path 'C:\windows\system32\git-secrets.1' because it does not exist.
At C:\Users\ricci\Downloads\git-secrets\install.ps1:16 char:1
+ Copy-Item ./git-secrets.1 -Destination $InstallationDirectory -Force
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (C:\windows\system32\git-secrets.1:String) [Copy-Item], ItemNo
   tFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.CopyItemCommand

Checking if directory already exists in Path...
Already in Path.
Adding to user session.
Done.

When I run git secrets --register-aws --global in a repo directory it returns git: 'secrets' is not a git command. See 'git --help'

Any idea what I need to do or where I can look for help?

Thanks

1 Answers

install.ps1 includes:

Param([string]$InstallationDirectory = $($Env:USERPROFILE + "\.git-secrets"))

It appears $Env:USERPROFILE is, in your session, C:\Windows\System32, which is not good.

Try and open a Powershell session:

  • as your own Windows account (not admin)
  • within your %USERPROFILE% Path (C:\Users\xxx) instead of C:\Windows\System32
Related