<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [git-documentdb](./git-documentdb.md) &gt; [RemoteRepository](./git-documentdb.remoterepository.md) &gt; [connect](./git-documentdb.remoterepository.connect.md)

## RemoteRepository.connect() method

Set a remote repository and connect to the remote repository. A remote repository will be created if not exists.

<b>Signature:</b>

```typescript
connect(repos: nodegit.Repository, credential_callbacks: {
        [key: string]: any;
    }, onlyFetch?: boolean): Promise<[GitRemoteAction, 'exist' | 'create']>;
```

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  repos | nodegit.Repository |  |
|  credential\_callbacks | { \[key: string\]: any; } |  |
|  onlyFetch | boolean |  |

<b>Returns:</b>

Promise&lt;\[GitRemoteAction, 'exist' \| 'create'\]&gt;

## Exceptions

[UndefinedPersonalAccessTokenError](./git-documentdb.undefinedpersonalaccesstokenerror.md) (from RemoteRepository\#create())

[PersonalAccessTokenForAnotherAccountError](./git-documentdb.personalaccesstokenforanotheraccounterror.md) (from RemoteRepository\#create())

[CannotConnectError](./git-documentdb.cannotconnecterror.md) (from RemoteRepository\#create())

[AuthenticationTypeNotAllowCreateRepositoryError](./git-documentdb.authenticationtypenotallowcreaterepositoryerror.md) (from RemoteRepository\#create())

[FetchConnectionFailedError](./git-documentdb.fetchconnectionfailederror.md)

[CannotCreateRemoteRepositoryError](./git-documentdb.cannotcreateremoterepositoryerror.md)

[PushConnectionFailedError](./git-documentdb.pushconnectionfailederror.md)

