diff options
Diffstat (limited to 'repository.go')
-rw-r--r-- | repository.go | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/repository.go b/repository.go index 9bdccc0..bf45fdc 100644 --- a/repository.go +++ b/repository.go @@ -23,8 +23,16 @@ type Repository struct { } // NewRepository creates a new repository setting remote as default remote -func NewRepository(url string) (*Repository, error) { - remote, err := NewRemote(url) +func NewRepository(url string, auth common.AuthMethod) (*Repository, error) { + var remote *Remote + var err error + + if auth == nil { + remote, err = NewRemote(url) + } else { + remote, err = NewAuthenticatedRemote(url, auth) + } + if err != nil { return nil, err } |