awslabs / git-secrets

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

template install fails on Windows #123

Open smankoo-dbrs opened 5 years ago

smankoo-dbrs commented 5 years ago

trying to install template "~" directory, instead of being installed in %USERPROFILE%

git-secrets release: 1.3.0


PS D:\gittest\.git\hooks> $PSVersionTable.PSVersion

Major  Minor  Build  Revision
-----  -----  -----  --------
5      1      17763  316

PS D:\gittest\.git\hooks> cd
PS D:\gittest\.git\hooks> cd\
PS D:\> dir -Force

    Directory: D:\

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d--hs-         3/6/2019   1:40 PM                $RECYCLE.BIN
d-----        5/14/2019   3:42 PM                badreports
d-----        4/16/2019   1:42 PM                bin
d-----         5/1/2019  10:25 AM                github
d-----        5/16/2019  12:18 PM                gittest
d-----        5/16/2019   2:16 PM                gittest2
d-----         3/8/2019   5:37 PM                Logs
d--h--        4/30/2019  10:55 AM                OneDriveTemp
d-----        3/18/2019   2:38 PM                PSTools
d--hs-         3/6/2019   1:24 PM                System Volume Information
d-----         3/6/2019   1:24 PM                Users
-a----        3/18/2019   2:43 PM            626 admin.ps1
-a----        5/14/2019   3:43 PM           4290 rds_sg_info_dbrsdpp.txt
-a----        5/14/2019   3:44 PM           6014 rds_sg_info_dbrspoc.txt
-a----        5/14/2019   3:44 PM           4151 rds_sg_info_dbrsprod.txt
-a----        5/14/2019   3:42 PM           2116 test.sh

PS D:\> git secrets --install ~/.git-templates/git-secrets
✓ Installed commit-msg hook to ~/.git-templates/git-secrets/hooks/commit-msg
✓ Installed pre-commit hook to ~/.git-templates/git-secrets/hooks/pre-commit
✓ Installed prepare-commit-msg hook to ~/.git-templates/git-secrets/hooks/prepare-commit-msg
PS D:\> dir -Force

    Directory: D:\

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d--hs-         3/6/2019   1:40 PM                $RECYCLE.BIN
d-----        5/14/2019   3:42 PM                badreports
d-----        4/16/2019   1:42 PM                bin
d-----         5/1/2019  10:25 AM                github
d-----        5/16/2019  12:18 PM                gittest
d-----        5/16/2019   2:16 PM                gittest2
d-----         3/8/2019   5:37 PM                Logs
d--h--        4/30/2019  10:55 AM                OneDriveTemp
d-----        3/18/2019   2:38 PM                PSTools
d--hs-         3/6/2019   1:24 PM                System Volume Information
d-----         3/6/2019   1:24 PM                Users
d-----        5/16/2019   2:22 PM                ~
-a----        3/18/2019   2:43 PM            626 admin.ps1
-a----        5/14/2019   3:43 PM           4290 rds_sg_info_dbrsdpp.txt
-a----        5/14/2019   3:44 PM           6014 rds_sg_info_dbrspoc.txt
-a----        5/14/2019   3:44 PM           4151 rds_sg_info_dbrsprod.txt
-a----        5/14/2019   3:42 PM           2116 test.sh

PS D:\>
sparr commented 1 year ago

I believe that ~ expansion was not available in PowerShell 5.1, but more recently it is available as an experimental feature (https://github.com/orgs/PowerShell/discussions/15263), and may be further available even more recently.

Could you try with and without that experimental feature enabled and confirm whether you are able to proceed?