awslabs / git-secrets

Prevents you from committing secrets and credentials into git repositories
Apache License 2.0
12.44k stars 1.18k forks source link

Windows: git: 'secrets' is not a git command #61

Open StianOvrevage opened 6 years ago

StianOvrevage commented 6 years ago

I have tried (and tried, and tried) getting git-secrets to work with GitHub Desktop for Windows without luck.

I have put the git-secrets bash script in one location that is now available within the git shell launched from GitHub Desktop (it's also in %PATH%):

curl -o "C:\Program Files\Git\cmd\git-secrets" https://raw.githubusercontent.com/awslabs/git-secrets/master/git-secrets

Running git secrets in cmd, git-bash AND powershell manually all gives me the "usage" output.

However, trying to commit with GitHub Desktop gives me

2017-12-13 16:30:05.7169|INFO|thread: 4|ProcessWrapper|Starting: Process - FileName: 'C:\Users\Stian\AppData\Local\GitHub\PortableGit_f02737a78695063deace08e96d5042710d3e32db\cmd\git.exe
...
2017-12-13 16:30:06.1735|WARN|thread: 1|StandardUserErrors|Showing user error Failed to create a new commit.
GitHub.IO.ProcessException: git: 'secrets' is not a git command. See 'git --help'.

I get the option to view error log and also "Open Git Shell". When I do Open Git Shell and execute git secrets, that works and gives me the "usage" output again.

Manually running the git.exe file in question with "secrets" also works:

C:\Users\Stian>C:\Users\Stian\AppData\Local\GitHub\PortableGit_f02737a78695063deace08e96d5042710d3e32db\cmd\git.exe secrets
usage: git secrets --scan [-r|--recursive] [--cached] [--no-index] [--untracked] [<files>...]

Have tried setting Default shell in GitHub Desktop to Cmd, Git Bash and Powershell. They all fail.

go0ty commented 6 years ago

I would also like to see functionality with GitHub Desktop windows app.

lbonanomi commented 5 years ago

In-case any other git-bash users come across this problem, save a copy of git-secrets in C:\Program Files\Git\usr\bin.

Git scans $PATH for any executable with the naming scheme git-* and will treat them as git sub-commands.

sparr commented 1 year ago

@StianOvrevage Could you try outputting %PATH% during a git invocation from Github Desktop to confirm whether C:\Program Files\Git\cmd is on tis path?