diff --git a/api/http/handler/stacks/stack_update_git.go b/api/http/handler/stacks/stack_update_git.go index da4df4e42..75713e14d 100644 --- a/api/http/handler/stacks/stack_update_git.go +++ b/api/http/handler/stacks/stack_update_git.go @@ -136,7 +136,6 @@ func (handler *Handler) stackUpdateGit(w http.ResponseWriter, r *http.Request) * stack.UpdatedBy = user.Username stack.UpdateDate = time.Now().Unix() - stack.GitConfig.Authentication = nil if payload.RepositoryAuthentication { password := payload.RepositoryPassword if password == "" && stack.GitConfig != nil && stack.GitConfig.Authentication != nil { @@ -150,6 +149,8 @@ func (handler *Handler) stackUpdateGit(w http.ResponseWriter, r *http.Request) * if err != nil { return &httperror.HandlerError{StatusCode: http.StatusInternalServerError, Message: "Unable to fetch git repository", Err: err} } + } else { + stack.GitConfig.Authentication = nil } if payload.AutoUpdate != nil && payload.AutoUpdate.Interval != "" {