Skip to content

Commit 7a708ac

Browse files
committed
set request auth if both username and password are non empty
BitBucket servers don't accept a username with an empty password, so a secret with no http auth creds will result in a 401, since we fall back to "git" for the username and used to set basic auth with that username without a password. Signed-off-by: Sanskar Jaiswal <[email protected]>
1 parent 7c07b7a commit 7a708ac

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/git/libgit2/managed/http.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ func createClientRequest(targetURL string, action git2go.SmartServiceAction,
279279

280280
// Apply authentication and TLS settings to the HTTP transport.
281281
if authOpts != nil {
282-
if len(authOpts.Username) > 0 {
282+
if authOpts.Username != "" && authOpts.Password != "" {
283283
req.SetBasicAuth(authOpts.Username, authOpts.Password)
284284
}
285285
if len(authOpts.CAFile) > 0 {

0 commit comments

Comments
 (0)