mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-30 05:04:22 +01:00
Solving error on authentication
This commit is contained in:
1 parent
d6578df998
commit
faeb0914b2
1 file changed
+10
-2
+10
-2
@@ -15,6 +15,7 @@ import (
|
|||||||
diffType "gopkg.in/src-d/go-git.v4/plumbing/format/diff"
|
diffType "gopkg.in/src-d/go-git.v4/plumbing/format/diff"
|
||||||
"gopkg.in/src-d/go-git.v4/plumbing/object"
|
"gopkg.in/src-d/go-git.v4/plumbing/object"
|
||||||
"gopkg.in/src-d/go-git.v4/plumbing/storer"
|
"gopkg.in/src-d/go-git.v4/plumbing/storer"
|
||||||
|
gitHttp "gopkg.in/src-d/go-git.v4/plumbing/transport/http"
|
||||||
"gopkg.in/src-d/go-git.v4/storage/memory"
|
"gopkg.in/src-d/go-git.v4/storage/memory"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -98,10 +99,17 @@ func (repoInfo *RepoInfo) clone() error {
|
|||||||
Auth: config.sshAuth,
|
Auth: config.sshAuth,
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
repo, err = git.Clone(memory.NewStorage(), nil, &git.CloneOptions{
|
options := &git.CloneOptions{
|
||||||
URL: opts.Repo,
|
URL: opts.Repo,
|
||||||
Progress: os.Stdout,
|
Progress: os.Stdout,
|
||||||
})
|
}
|
||||||
|
if os.Getenv("GITHUB_TOKEN") != "" {
|
||||||
|
options.Auth = &gitHttp.BasicAuth{
|
||||||
|
Username: "fakeUsername", // yes, this can be anything except an empty string
|
||||||
|
Password: os.Getenv("GITHUB_TOKEN"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
repo, err = git.Clone(memory.NewStorage(), nil, options)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
repoInfo.repository = repo
|
repoInfo.repository = repo
|
||||||
|
|||||||
Reference in new issue
Block a user