This method allows you to add your repository details to a project.

**Tip**: You can explore and test this endpoint interactively using our [OpenAPI documentation](https://api.deployhq.com/docs).

## URL

```
/projects/<project>/repository
```

## HTTP Method

```
POST
```

## Supported Parameters

* `scm_type` - One of either `git`, `subversion` or `mercurial` (required)
* `url` - Full URL to the repository (required)
* `port` - The port to connect to your repository (optional)
* `branch` - The default branch you wish to deploy from (optional)

### SVN & Mercurial

The following parameters are only supported for SVN and Mercurial repositories.

* `username` - The username to authenticate with
* `password` - The password to authenticate with

## Example cURL Request

```
curl -H "Content-type: application/json" \
-H "Accept: application/json" \
--user adam@atechmedia.com:my-api-key \
-X POST \
-d { \
  "repository" : { \
    "scm_type": "git", \
    "url": "git@github.com:test/test.git", \
    "port": null, \
    "username": null, \
    "branch": "master", \
  } \
} \
https://test.deployhq.com/projects/project/repository
```

## Example Response

```json
{
    "scm_type": "git",
    "url": "git@github.com:danquinney/test.git",
    "port": null,
    "username": null,
    "branch": "master",
    "cached": false,
    "hosting_service": {
        "name": "GitHub",
        "url": "http://github.com",
        "tree_url": "https://github.com/danquinney/test/tree/master",
        "commits_url": "https://github.com/danquinney/test/commits/master"
    }
}
```