Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

catch case when hook path is default

Maidul Islamf2de1778cb8e
diff --git a/cli/packages/cmd/scan.go b/cli/packages/cmd/scan.go
index cc8cd2e699..1226e33199 100644
--- a/cli/packages/cmd/scan.go
+++ b/cli/packages/cmd/scan.go
@@ -526,7 +526,11 @@ func GetGitRoot() (string, error) {
func getHooksPath() (string, error) {
out, err := exec.Command("git", "config", "core.hooksPath").Output()
if err != nil {
- return "", fmt.Errorf("failed to get Git hooks path: %s", err)
+ if len(out) == 0 {
+ out = []byte(".git/hooks") // set the default hook
+ } else {
+ log.Error().Msgf("Failed to get Git hooks path: %s\nOutput: %s\n", err, out)
+ }
}
hooksPath := strings.TrimSpace(string(out))