> ## Documentation Index
> Fetch the complete documentation index at: https://code.storage/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# store.createGitCredential()

> Store a Git credential for a repository configured with a generic HTTPS Git provider.

> [!WARNING]
>
> This page documents the earlier Code Storage SDKs: `@pierre/storage`, `pierre-storage`, and
> `code-storage-go`. New code uses the [Pierre SDK](https://code.storage/docs/sdks.md). To move code to the new SDK, use the
> [`pierre-migrate`
> skill](https://github.com/pierrecomputer/skills/tree/main/skills/pierre-migrate).

```typescript TypeScript theme={null} theme={"theme":{"light":"github-light","dark":"min-dark"}}
const credential = await store.createGitCredential({
  repoId: repo.id,
  username: 'git',
  password: 'YOUR_ACCESS_TOKEN_OR_PASSWORD',
});

console.log(credential.id);
```

```python Python theme={null} theme={"theme":{"light":"github-light","dark":"min-dark"}}
credential = await storage.create_git_credential(
    repo_id=repo.id,
    username="git",
    password="YOUR_ACCESS_TOKEN_OR_PASSWORD",
)

print(credential.id)
```

```go Go theme={null} theme={"theme":{"light":"github-light","dark":"min-dark"}}
credential, err := client.CreateGitCredential(context.Background(), storage.CreateGitCredentialRequest{
	RepoID:   repo.ID,
	Username: "git",
	Password: "YOUR_ACCESS_TOKEN_OR_PASSWORD",
})

fmt.Println(credential.ID)
```

## Options

**repoId** `string` *required*

The ID of the repository to attach the credential to.

**username** `string`

Git username. Optional for providers that accept a token without a username.

**password** `string` *required*

Git password or access token used to authenticate with the upstream provider.

## Response

**id** `string`

The credential ID. Use this to update or delete the credential later.

**createdAt** `string`

ISO 8601 timestamp of when the credential was created.

## Related

* [updateGitCredential()](https://code.storage/docs/sdk/repos/git-credential-update.md)
* [deleteGitCredential()](https://code.storage/docs/sdk/repos/git-credential-delete.md)
* [Generic Sync](https://code.storage/docs/repos/generic-sync.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.