Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions clients/git/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package git

import (
"errors"
"fmt"
"os"
"os/exec"
"regexp"
Expand Down Expand Up @@ -53,8 +52,6 @@ func Clone(url, targetDir string) error {
// Include the git output in the error message
return clierrors.WrapError("git clone failed: "+string(output), err)
}
// Print output on success
fmt.Print(string(output))
return nil
}

Expand Down
14 changes: 9 additions & 5 deletions cmd/app/helper.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package app

import (
stderrors "errors"
"fmt"
"os"
"os/exec"
Expand Down Expand Up @@ -94,13 +95,12 @@ func cloneRepository(sshURL, httpsURL, targetDir string) (string, error) {
}

// isGitAuthError checks if the error is related to git authentication/permission issues
// It checks all wrapped errors in the chain, not just the top-level error
func isGitAuthError(err error) bool {
if err == nil {
return false
}

errMsg := strings.ToLower(err.Error())

// Common git authentication error patterns
authErrorPatterns := []string{
"repository not found", // Catches "ERROR: Repository not found."
Expand All @@ -113,9 +113,13 @@ func isGitAuthError(err error) bool {
"fatal: unable to access",
}

for _, pattern := range authErrorPatterns {
if strings.Contains(errMsg, pattern) {
return true
// Check all errors in the chain
for e := err; e != nil; e = stderrors.Unwrap(e) {
errMsg := strings.ToLower(e.Error())
for _, pattern := range authErrorPatterns {
if strings.Contains(errMsg, pattern) {
return true
}
}
}

Expand Down