# Record an agent's Git repository

Source: https://docs.vlayers.ai/reference/hosting/put-agent-source-git

`PUT /v1/agents/{id}/source/git` · scope `workspace:write`

Records the repository's https address, the branch and, for a private repository, the connection that holds the credential (from your Connections). The address may not carry a user name or token; they go in the connection, never in this record. Nothing is cloned or pushed by this call.

Requires an API key with the `workspace:write` scope.

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `id` | path | string | yes | The agent id. Example: `"0192f5c2-6f7a-7b9c-8d1e-2f3a4b5c6d78"` |
| `repoUrl` | body | string | yes | The repository's https address, for example `https://github.com/acme/agent`. |
| `branch` | body | string | no | The branch. Default `main`. |
| `connectionId` | body | string | no | The connection that holds the Git credential, or `null` for a public repository. |

## Request

cURL:

```bash
curl -X PUT "https://api.vlayers.ai/v1/agents/$AGENT_ID/source/git" \
  -H "Authorization: Bearer $VOICELAYER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "repoUrl": "https://example.com/acme/agent",
    "branch": "main",
    "connectionId": null
  }'
```

TypeScript:

```ts
import { VoiceLayer } from '@voicelayer/api';

const voicelayer = new VoiceLayer();

const { git } = await voicelayer.hosting.putAgentSourceGit('<agent-id>', {
  repoUrl: 'https://example.com/acme/agent',
  branch: 'main',
  connectionId: null
});
console.log(git);
```

Python:

```python
from voicelayer import VoiceLayer

vl = VoiceLayer()

result = vl.hosting.put_agent_source_git(
    "<agent-id>",
    repo_url="https://example.com/acme/agent",
    branch="main",
    connection_id=None,
)
print(result.git)
```

## Response `200`

```json
{
  "git": {
    "repoUrl": "https://github.com/acme/agent",
    "branch": "main",
    "connectionId": null,
    "connectionMissing": false,
    "updatedAt": "2026-10-20T15:04:05.000Z",
    "updatedBy": "user_2abc"
  }
}
```
